I.1.X03What the intercept buys
gradient▲▲△Repeat the derivation of I.1.B03 for the two-parameter model
y^=wx+b. Derive both partial derivatives, set them to zero, solve for
w and b on the same three points (1,2),(2,4),(3,5), and compare the
optimal loss with the through-origin fit.
Hint
Setting ∂L/∂b=0 first gives b in terms of w and the
means. Substituting that back leaves one equation in w.
Solution
Step 1 — the two partials. With ri=wxi+b−yi and
L=2n1∑ri2:
∂w∂L=n1i∑xiri,∂b∂L=n1i∑riThe second is the first with xi replaced by 1 — which is exactly right,
since the bias is the weight on a constant input of 1. That is worth
remembering: a bias is not a special kind of parameter, only a weight whose
feature happens to be constant.
Step 2 — the normal equations. Setting both to zero:
w∑xi2+b∑xi=∑xiyi,w∑xi+nb=∑yiStep 3 — the sums.
n=3,∑xi=6,∑yi=11,∑xiyi=25,∑xi2=14Step 4 — solve. Eliminating b gives the standard form
w=n∑xi2−(∑xi)2n∑xiyi−∑xi∑yi=3(14)−363(25)−(6)(11)=42−3675−66=69=1.5000and then from the second equation
b=n∑yi−w∑xi=311−(1.5)(6)=32=0.6667
Step 5 — the residuals and the loss.
r1=+0.1667,r2=−0.3333,r3=+0.1667L=61(0.0278+0.1111+0.0278)=0.0278
against 0.0595 for the through-origin fit of I.1.B03.
What the intercept bought. The loss more than halved, from 0.0595 to
0.0278. But notice something sharper in the residuals: they sum to
0.1667−0.3333+0.1667=0.0000. That is not a coincidence — it is exactly
what ∂L/∂b=0 says. A fitted intercept forces the mean
residual to zero. The through-origin model has no such constraint, and its
residuals do not sum to zero.
So the intercept did not merely add flexibility; it added a specific,
nameable property to the fit. That is the honest way to describe what any
parameter buys.