Notes

Mean Squared Error (MSE)

When a model predicts a number—like a house price or next week’s demand—you need a way to say “how wrong was it?” Mean Squared Error (MSE) answers that by turning prediction mistakes into a single score you can compare across models.

What MSE measures

Mean Squared Error (MSE) is the average of the squared differences between the true values and the model’s predictions. If the true target is y and the prediction is ŷ, each data point has a residual (error) y − ŷ. MSE squares those residuals and averages them:

MSE = (1/n) * Σ (y_i - ŷ_i)^2

Squaring does two things: it makes negative and positive errors count the same, and it penalizes large errors much more than small ones (a 10-unit miss hurts 100× more than a 1-unit miss).

Why it matters in supervised regression

MSE is more than a reporting metric—it’s tightly connected to how many regression models learn. Minimizing MSE corresponds to maximum likelihood under a Gaussian noise assumption, which is why linear regression is commonly fit by minimizing squared error. Because MSE heavily weights big misses, it pushes models to avoid occasional disastrous predictions, which is valuable in settings like credit loss prediction or demand forecasting where large errors are costly.

Practical use and interpretation

  • House prices: a few badly underpriced luxury homes can dominate MSE, revealing sensitivity to outliers.
  • Fraud loss prediction: MSE prioritizes getting high-loss cases closer, not just being “pretty good” on average.
  • In scikit-learn: use mean_squared_error or the scoring name "neg_mean_squared_error" in cross-validation.

MSE is in squared units (dollars², kWh²), so people often also report RMSE (the square root) for readability, while keeping MSE for optimization and comparisons.

Mean Squared Error (MSE) is a regression metric defined as the average of the squared differences between predicted values and true targets: MSE = (1/n)∑(ŷ − y)². Squaring makes all errors positive and penalizes larger mistakes more heavily, and the result is expressed in squared units of the target. MSE matters because it is a standard objective for training and comparing regression models, strongly shaping sensitivity to outliers and large deviations.

Imagine you’re practicing basketball free throws and you keep track of how far each shot lands from the hoop. If you want to punish big misses more than small ones, you might square each miss distance before averaging them. That’s the basic idea behind Mean Squared Error (MSE).

In AI, when a model predicts a number (like a house price or tomorrow’s temperature), MSE measures how wrong those predictions are on average. It takes each prediction’s error, squares it (so large mistakes count a lot), and then averages across all examples. Lower MSE means the model’s predictions are closer to reality.