One feature (house size):
fw,b(x) = wx + b
Many features:
| Feature | Variable | Example |
|---|---|---|
| Size (sq ft) | x1 | 2104 |
| # Bedrooms | x2 | 5 |
| # Floors | x3 | 1 |
| Age (years) | x4 | 45 |
More features = more information to predict price.
| Symbol | Meaning | Example |
|---|---|---|
| xj | The jth feature | x3= # of floors |
| n | Total number of features | n = 4 |
| x(i) | All features of the ith training example (a vector) | x(2)= [1416, 3, 2, 40] |
| xj(i) | Feature j of training example i | x3(2)= 2 (2nd example, 3rd feature) |
Note: Bold notation indicates a vector (a list of numbers), not a single number.
f,b(x) = w1x1 + w2x2 + w3x3 + w4x4 + b
General form with n features:
f,b(x) = w1x1 + w2x2 + ⋯ + wnxn + b
price = 0.1x1 + 4x2 + 10x3 − 2x4 + 80
Interpreting the parameters (price in $thousands):
| Parameter | Value | Interpretation |
|---|---|---|
| b | 80 | Base price: $80,000 |
| w1 | 0.1 | +$100 per square foot |
| w2 | 4 | +$4,000 per bedroom |
| w3 | 10 | +$10,000 per floor |
| w4 | -2 | -$2,000 per year of age |
Define vectors to simplify the model: