Posts Root Mean Squared Error (RMSE) - Evaluation Metrics
Post
Cancel

Root Mean Squared Error (RMSE) - Evaluation Metrics

Brief

Root mean squared error is an evaluation metric used in measuring the accuracy of a model. It calculates the sum of squared differences and divides them by the number of records then takes the square root of that. In short, if you know MSE (mean squared error) then this is the square root of that. Let’s see the formula and understand it better.

Formula

\begin{equation} \mathrm{RMSE}= \sqrt{\frac{1}{\mathrm{n}} \sum_{\mathrm{i}=1}^{\mathrm{n}} \left( \mathrm{y}_{\mathrm{i}}-\mathrm{\hat y} _ {\mathrm{i}}\right)^{2}} \end{equation}

Explanation

Here, \( \sum \) = symbol for doing addition of values,
n = number of records,
i = record index starting from 1 (first record),
y = actual record from our testing data,
\( \mathrm{\hat y} \) = predicted value of y record from a model,

So, this formula will calculate the sum of squared differences between the actual value y and predicted value \( \mathrm{\hat y} \) (yhat) for all records and divide them by n the number of records and then take the square root of it. The difference between RMSE and MSE is that in RMSE we are taking square root and rest is all the same for both. If you want to know more about MSE then check out MSE (mean squared error) here.

Example

Let’s look at one example for better understanding:

Actual ValuePredicted ValueDifference
10.312.5-2.2
25.722.13.6
15.811.24.6

I have used the same example used in MSE so that we can understand it better.
Now, if we calculate the summation of squared differences, it would be like:
\( (-2.2)^2+(3.6)^2+(4.6)^2\)
\( = 4.84 + 12.96 + 21.16 = 38.96\)
38.96 is our sum of differences. Now, we will divide 38.96 by 3 which is the number of records in this case:

\( 38.96 / 3 = 12.99\)
\( \sqrt{12.99} = 3.61\)

3.61 is our RMSE (Root Mean Squared Error).
That’s it! You are done with the RMSE (Root Mean Squared Error).

This post is licensed under CC BY 4.0 by the author.