The one-feature line
So far we only looked at temperature. The least squares line is sales = 1.59 · temperature + 4.43, with a loss of 4.31.
Weekends
The yellow dots are weekend days. The one-feature line cannot see this difference, because it only looks at temperature. You can change which days are weekends in the Try tab.
A second feature
We add a second feature to each day: 1 on a weekend, 0 otherwise. Now each day is a feature vector of two numbers and the model is prediction = w₁ · temperature + w₂ · weekend + b.
Two parallel lines
Since weekend can only be 0 or 1, the model draws two parallel lines: black for weekdays, yellow for weekends. Both have the same slope, w₁ = 1.48.
w₂, the gap between the lines
The vertical gap between the two lines is w₂ = 3.33: at the same temperature, the weekend prediction differs from the weekday one by this much.
What happened to the loss
The two-feature model has a loss of 2.16; the one-feature line had 4.31. A new feature does not raise the training loss; seeing whether it really helps needs days the model has not seen.
More features
The features become the columns of a matrix X, with a column of ones at the front. The weights are found in one step with the normal equation (Xᵀ X) β = Xᵀ y; the computation is the same even with hundreds of features.
Why it matters
Real predictions do not look at a single feature: a house price depends on floor area, rooms and district. A neuron in a neural network is exactly this: a weighted sum of its inputs plus b.