One feature draws a line. Two features draw a plane. Rotate it, tilt it, and see how a model weighs several things at once to predict a price.
Simple regression uses one input. Here the model uses two: Size (x₁) and Age (x₂) to predict Price (y). Each input gets its own weight, and the intercept lifts or lowers the whole plane: ŷ = b + w₁·x₁ + w₂·x₂.
Exactly like before: for each point, error = prediction − real value. Squared and averaged, that is the MSE. Turn on Show errors to see each gap as a vertical line.
Now there are three numbers to learn (b, w₁, w₂). Gradient descent starts from any plane and nudges all three at once, a little downhill each step. Press Run and watch the plane swing toward the data.
Every weight has its own gradient: how much the error changes if that weight moves. Each step subtracts η times its gradient. If the two features are strongly linked, one direction of the bowl is very flat and descent crawls. Try the second challenge below.
Why not run two separate simple regressions? Because a weight in a multiple model means “the effect of this feature while the others stay fixed”. When features overlap, that can differ a lot from the effect on its own.
Like the single-feature case, the best plane can be solved directly. Collect sums of the data into a small matrix, then solve the three equations at once: w = (XTX)−1 XTy.
Link Size and Age at 0.95. See the weights become unstable and “alone” differ from “together”.
Add a point far from the plane. Watch the best plane tilt to chase it.
Set η to 0.18 and run. All three weights overshoot and the plane flies away.