← AI Terminology
MSE - Mean Squared Error
Mean Squared Error (MSE) is a regression loss function and evaluation metric that measures the average squared difference between predictions and actual values — disproportionately penalising large errors due to squaring.
It is the most common loss function for regression tasks in machine learning.
It is the most common loss function for regression tasks in machine learning.
Why It Matters in AI
MSE is mathematically convenient (differentiable everywhere, smooth gradient), statistically principled (maximum likelihood estimator under Gaussian noise), and heavily penalises large errors — making it appropriate when large mistakes are disproportionately costly. It is the default regression loss in almost all ML frameworks. However, its sensitivity to outliers means a single bad prediction can dominate the metric — understanding this tradeoff vs. MAE is essential for metric selection.
Key Points
| Aspect | Description |
|---|---|
| RMSE | Root Mean Squared Error — √MSE, same units as target, preserves outlier sensitivity of MSE |
| Units | Squared units of target — less interpretable than MAE (use RMSE = √MSE for interpretability) |
| vs MAE | MSE penalises large errors more heavily (squares them); MAE is robust to outliers |
| Formula | MSE = (1/n) × Σ (yᵢ − ŷᵢ)² — mean of squared differences between predictions and actuals |
| L2 loss | MSE is equivalent to L2 loss used as a training objective |
| Gradient | ∂MSE/∂ŷᵢ = 2(ŷᵢ − yᵢ) — smooth, proportional to error magnitude — ideal for gradient descent |
Simple Analogy
A judge scoring diving: a diver who splashes a lot (big error) gets penalised heavily because the score is based on the square of the splash size. Small splashes (small errors) barely affect the score. MSE builds this "big mistakes matter disproportionately" rule into every regression training run.
Common Usage Examples
sklearn.metrics.mean_squared_error(y_true, y_pred)— evaluationloss = nn.MSELoss()(predictions, targets)— PyTorch regression training lossrmse = np.sqrt(mean_squared_error(y_true, y_pred))— RMSE for interpretable reporting- Image super-resolution: pixel-level MSE between predicted and ground-truth high-res images
keras.losses.MeanSquaredError()— Keras regression loss
Summary
In short: MSE is the standard regression loss — differentiable, statistically principled, and heavily penalising large errors — making it the default choice for training regression models and evaluating continuous predictions.