Squared loss assigns a prediction the squared difference between its predicted value and the observed value: (y − ŷ)². In regression, ordinary least squares sums these squared residuals to choose model coefficients. section 3.4.1 section 11.2.3
Squaring the discrepancy shapes what the fitting process treats as error:
- It prevents positive and negative residuals from canceling, and gives larger residuals greater weight. section 3.4.1
- With normally distributed errors, minimizing the sum of squared residuals gives the same regression coefficients as maximizing the likelihood. section 3.4.2
- For neural-network regression, squared error measures prediction loss; backpropagation uses the loss gradient to guide parameter updates. section 11.2
Study hours and exam scores
A fitted line predicts a score of 7.85 for a student who studies seven hours. The observed score is 8.1, so the residual is 0.25 and its squared error is 0.0625. section 3.4.3




