Artificial intelligence · lesson 1 of 4
Linear regression, residuals and squared loss
A linear model predicts yhat=w·x+b. Linear refers to the parameters; feature transformations may make the relation nonlinear in original inputs.
Learn the ideas
Prerequisites: Algebra, averages and basic derivatives.
Prediction
A linear model predicts yhat=w·x+b. Linear refers to the parameters; feature transformations may make the relation nonlinear in original inputs.
Residual
Define residual consistently, for example yhat−y. Squared loss penalizes larger residuals more heavily.
Mean loss
MSE is the mean squared residual over the evaluated examples. It has squared target units and is not the same as mean absolute error.
Interpretation
Good fit on observed data does not establish causation or reliable extrapolation. Inspect residual patterns and the intended data range.
Worked examples
For yhat=2x+3 and x=4, calculate the prediction.
2×4+3=11.
11
For prediction 7 and target 5, calculate squared error.
(7−5)²=4.
4
Check your understanding
8 questionsDecimals or fractions are accepted for numeric answers. Proofs and written responses use sample answers and require human marking. This is practice, not a protected examination.
Further reading and review references
These are reference links, not copied exercises, institutional endorsement or proof of independent review.