Linear Regression
Explore how a line of best fit is calculated to model the relationship between variables. Adjust data points and watch the regression line update in real-time.
Supervised Learning Example
Predicting house prices based on size — drag the point to see predictions
House sizes and prices
Regression model
Predicts numbers
Infinitely many possible outputs
Supervised learning
Data has "right answers"
Model learns from labeled examples
Classification model
Predicts categories
Small number of possible outputs
Terminology
Training set: Data used to train the model
| x(size in ft²) | y(price in $1000's) | |
|---|---|---|
| (1) | 2104 | 400 |
| (2) | 1416 | 232 |
| (3) | 1534 | 315 |
| (4) | 852 | 178 |
| ... | ... | ... |
| (47) | 3210 | 870 |
Notation
x = "input" variable (feature)
y = "output" variable ("target" variable)
m = number of training examples
(x,y) = single training example
(x(i),y(i)) = ith training example
Examples
x(1)=2104, y(1)=400
(x(1),y(1))=(2104,400)
x(2)=1416
In this dataset: m=47
Important: Superscript notation
x(2)=x2
The superscript (i) in parentheses denotes the index of the training example, not an exponent.