Fit an intercept-only predictor for squared error
Check signs and decimal points before moving to the next value. · 184 words
An intercept-only predictor uses one constant for every input. Suppose a museum gift shop records 2, 4, and 6 books sold on three similar days. The model chooses an intercept a and predicts a each time. Squared error is (observed value - prediction)^2. Test nearby constants by hand. Predicting 3 gives losses 1, 1, and 9, totaling 11. Predicting 4 gives losses 4, 0, and 4, totaling 8. Predicting 5 also gives 11, so 4 is the best of these.
The fitted constant follows a general rule: with squared error, the best intercept-only predictor is the arithmetic mean of the training targets. The mean balances errors because moving the constant too low makes predictions too small, while moving it too high makes them too large. For a second example, a weather station records temperatures of 10, 14, and 18 degrees. Their mean is 14, so the model predicts 14 each time. Its squared-error total is 16 + 0 + 16 = 32. The constant 12 produces 4 + 4 + 36 = 44, and 16 also produces 44. Thus the mean gives the minimum.
Check your recall
For target values 2, 4, and 6, what intercept minimizes squared error, and what is the total squared error?
Check your answer
The fitted intercept is 4. The squared errors are 4, 0, and 4, so the total squared error is 8.
Sources and credits
Original KeyTouch lesson. Background reading · Google · Linear regression.