Mean Squared Error (MSE)
Average of squared differences between predicted and actual values.
Formula
Variables
Example
For errors 2, -1, 3: MSE = (4+1+9)/3 = 4.67
How it works
Mean Squared Error measures how far a model’s predictions are from the true values by taking each error, squaring it, and then averaging those squared errors. Squaring makes all errors positive and gives extra weight to larger mistakes, so a few big misses count more than many small ones. It is widely used because it is smooth, easy to optimize, and directly penalizes large prediction errors.
When to use it
Use MSE when you want to evaluate or train a regression model and care more about large errors than small ones. It is common in forecasting, pricing, sensor prediction, and other problems where predicted numbers should be close to actual numeric targets.
Worked example, step by step
Actual values: 5, 7, 6 Predicted values: 4, 9, 5 Errors: 5-4 = 1, 7-9 = -2, 6-5 = 1 Squared errors: 1^2 = 1, (-2)^2 = 4, 1^2 = 1 Sum of squared errors: 1 + 4 + 1 = 6 Number of samples: 3 MSE = 6 / 3 = 2
Common mistakes to avoid
- Forgetting to square the errors before averaging
- Using absolute errors instead of squared errors
- Mixing up actual values and predicted values in the subtraction
Did You Know?
MSE penalizes large errors heavily because the differences are squared.
Share this formula
More in Data Science & ML
View allRoot Mean Squared Error (RMSE)
BasicSquare root of MSE, in the same units as the target variable.
Mean Absolute Error (MAE)
BasicAverage of absolute differences between predictions and actual values.
Coefficient of Determination (R²)
IntermediateProportion of variance in the target explained by the model.
Classification Accuracy
BasicFraction of predictions that are correct.
Precision
IntermediateOf all positive predictions, the fraction that were correct.
Recall (Sensitivity)
IntermediateOf all actual positives, the fraction correctly identified.