- Introduced by
- Carl Friedrich Gauss
- Year
- 1809
- Type
- Distance-based evaluation metric
- Family
- Error metric
What does it do?
Root mean squared error (RMSE) is the square root of the mean of squared residuals.
It gives a single figure for the typical size of prediction errors in a regression model, expressed in the units of the target variable. Because residuals are squared before averaging, large errors carry more weight than small ones. The least-squares framework it draws on is associated with Gauss (1809) and Legendre (1805).
The intuition behind the method
RMSE squares each residual before averaging, so a large error adds much more to the total than a small one. If errors are roughly equal in size, RMSE is close to the typical absolute error. If a few errors are large, RMSE sits noticeably above the typical error, because it is never smaller than the mean absolute error and equals it only when all errors have the same magnitude. Taking the square root returns the value to the units of the target, so an RMSE of 10 means the errors are on the order of 10 units, with the largest errors pulling the figure upward.
History
Least squares was developed independently by Adrien-Marie Legendre (1805) and Carl Friedrich Gauss (1809), and Gauss applied it to the determination of celestial orbits. RMSE is the square root of the least-squares mean squared error and is now a standard error summary in regression.
When to use it
Choose RMSE for a continuous regression target when you want one summary of prediction error in the target's own units, and when large errors are disproportionately costly for the application at hand. It is a reasonable summary when you are comparing models on the same dataset and target. Do not use it when every unit of error has the same cost and you want that reflected directly; mean absolute error is the natural alternative. Avoid comparing raw RMSE across targets with different scales, and avoid it for percentage-based reporting or for categorical outcomes, where it does not apply. If the data contain outliers that are measurement errors rather than real events, the squared penalty lets them dominate the score, so a more robust metric may be preferable.
Limitations and considerations
- Because each residual is squared, a few outliers can dominate the value and push RMSE well above the typical error.
- The metric is absolute and scale-dependent; it does not express error as a percentage of the target.
- Over- and under-predictions of the same size are penalised identically, so it cannot encode an asymmetric cost in which one direction of error is worse.
- The square root is taken after averaging, so a sample RMSE is not an unbiased estimate of the root of the expected squared error. By Jensen's inequality it tends to fall slightly below that quantity on average, and the gap matters most for small samples.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Expressed in the units of the target variable, so the value can be read directly against the range of the quantity being predicted.
- Squaring before averaging weights large residuals heavily, which suits settings where a few large misses cost more than many small ones.
- Differentiable wherever it is non-zero, so it can be used in gradient-based fitting, although MSE is more often the direct training objective (see the FAQ).
- Widely reported in regression studies, so values are easy for other researchers to interpret.
Applications
- Weather forecasting: temperature predictions compared with observations, with error reported in the target's own unit.
- Price forecasting: prediction errors for a continuous price series, reported in currency units.
- Manufacturing: deviations of measured product dimensions from a target value, in the measurement unit.
- Dose planning: differences between a planned dose and a prescribed dose, in dose units.
- Satellite positioning: position error in distance units.
How it works
How it works
For each observation, compute the residual: the actual value minus the predicted value. The sign is kept at this stage and removed by squaring in the next step.
Formula
e_i = y_i - \hat{y}_iSquare each residual and take the mean across all observations. The result is the mean squared error, which is in squared units of the target.
Formula
MSE = \frac{1}{n} \sum_{i=1}^{n} e_i^2Take the square root of the mean squared error to return the figure to the units of the target variable.
Formula
RMSE = \sqrt{MSE} = \sqrt{\frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{y}_i)^2}Common pitfalls
- Comparing raw RMSE across datasets whose targets have different ranges or spreads. Normalise the value, or compare only on the same target.
- Reading RMSE alone. A single figure cannot show whether errors are spread evenly or driven by a few large residuals, so plot residuals against predictions and inputs.
- Evaluating on training data. In-sample RMSE tends to understate error on new data, especially for flexible models, so report it on held-out data.
- Treating RMSE or MAE as proof of accuracy. Both are in the target's units and give an intuitive size of error, but without domain knowledge they cannot show whether a model is accurate enough for the application. Judge the value against the target's spread and against a simple baseline, such as always predicting the target mean.
Frequently asked questions
Why take the square root? Why not just use MSE?
The square root returns the metric to the units of the target variable, so the value can be read against the target's range. MSE is in squared units, which is harder to interpret. Because the square root is monotonic, a model that minimises MSE on a given dataset also minimises RMSE on that dataset. MSE is often used as the training objective because its gradient has no square-root term.
How do I compare RMSE values across different datasets?
RMSE depends on the scale of the target, so raw values from datasets with different target ranges are not directly comparable. Dividing by a chosen normaliser gives a normalised RMSE (NRMSE). Common normalisers include the range, the mean and the standard deviation of the target, and the result depends on which one is used. Normalised values are comparable only if the same normaliser is applied to both datasets.
What is a good RMSE value?
There is no universal threshold. The same RMSE can be small relative to one target's range and large relative to another's. Judge it against the spread of the target and against a simple baseline, such as always predicting the mean of the target.
How does RMSE relate to R²?
Both measure model quality from different angles. R² quantifies the fraction of variance explained, is unitless, and equals 1 for a perfect fit, while RMSE measures error magnitude in the units of the target. A high R² does not guarantee a low RMSE if the target has high variance.
Should I use RMSE or MAE?
Use RMSE when large errors are disproportionately costly, and MAE when every unit of error has the same cost. Because RMSE weights large residuals more heavily, a few outliers can move it much more than MAE. Inspect residuals alongside either metric.
Related methods
Sources
Gauss, C. F. (1809). Theoria Motus Corporum Coelestium in Sectionibus Conicis Solem Ambientium. Hamburg: Perthes and Besser.
Open publication referenceLegendre, A. M. (1805). Nouvelles méthodes pour la détermination des orbites des comètes. Paris: F. Didot.
Open publication referenceHastie, T., Tibshirani, R., & Friedman, J. (2009). The Elements of Statistical Learning: Data Mining, Inference, and Prediction (2nd ed.). New York: Springer.
Open DOI reference