Mean Squared Error (MSE) Calculator
Calculate Mean Squared Error (MSE) between actual and predicted values for a regression model.
Inputs
Comma-separated actual (true) values.
Comma-separated predicted values, same order and count as actual.
Mean Squared Error
0.3750
Number of Samples
4
Step by step
Sum of squared errors: Σ(y_i − ŷ_i)²
(3 − 2.5)² + (-0.5 − 0)² + (2 − 2)² + (7 − 8)²
= 1.5000
MSE: sum of squared errors / n
1.5000 ÷ 4
= 0.3750
How it works
Mean Squared Error (MSE) is the average of squared prediction errors: MSE = (1/n) × Σ(y_i − ŷ_i)². Squaring the errors penalizes larger deviations disproportionately more than smaller ones, making MSE especially sensitive to outliers. MSE is also mathematically convenient because it's differentiable everywhere, which is why it's the default loss function for training many regression models via gradient descent. Its units are the square of the target variable's units, which is why RMSE (its square root) is often reported instead for easier interpretation.
Formula
MSE = (1/n) * sum((y_i - y_hat_i)^2)
- n
- Number of samples
- y_i
- Actual value for sample i
- \hat{y}_i
- Predicted value for sample i
Frequently Asked Questions
Why square the errors instead of using absolute value?
Squaring makes the loss function smooth and differentiable everywhere (unlike absolute value, which has a kink at zero), which is convenient for gradient-based optimization, and it heavily penalizes large errors, which can be desirable when big mistakes are especially costly.
Why is MSE hard to interpret directly?
MSE is in squared units of the target variable, so if you're predicting dollars, MSE is in 'dollars squared', which has no intuitive real-world meaning — RMSE converts this back to the original units by taking the square root.
Is MSE always non-negative?
Yes — since every term is a squared value, MSE is always greater than or equal to zero, with 0 occurring only when every prediction exactly matches its actual value.