liveBook · Manning

Root mean squared error

As explained in Grokking Machine Learning, Second Edition

Root mean square error is a metric equal to the square root of the mean of the squared differences between predictions and target values.

When a model predicts a house price, its error is the difference between the predicted and actual price. Root mean squared error, or RMSE, summarizes these differences in one number. section 3.23

To calculate RMSE, square every prediction error, find the average, and take the square root. Squaring makes large errors matter more; taking the root returns the result to the original units. An RMSE of $10,000 suggests the model is roughly $10,000 away per prediction. section 3.23

Use RMSE to compare prediction quality:

  • Average errors before comparing datasets of different sizes; a total error grows simply because a dataset contains more points. section 3.23
  • Interpret the result in the target's units, such as dollars for house prices rather than dollars squared. section 3.23
  • Treat a large RMSE as a clue rather than a final verdict: outliers or missing predictive features may explain it. section 3.27

Evaluating housing models

A linear regression model trained on Hyderabad housing data reports an RMSE close to 4,000,000. A polynomial model without regularization has testing RMSE 1862.044, while L1 and L2 regularization reduce it to 0.153 and 0.104 in the demonstrated dataset. The lower value indicates less typical prediction error within the evaluated data. section 3.27 section 4.14

 
Size (s)
Prize (p)
House 1
100
200
House 2
200
475
House 3
200
400
House 4
250
520
House 5
325
735

Work through the supplied house-size and price table by calculating predictions, mean absolute error, and RMSE. section 3.38

How Grokking Machine Learning, Second Edition covers it

How deep it goes
Defines the calculation, explains averaging and units, and demonstrates scikit-learn evaluation without developing deeper statistical theory.
Examples
Uses house-price prediction, Hyderabad housing data, polynomial-model comparisons, and a small house-size exercise.
What it assumes
Assumes predictions, target values, and basic regression context while explaining the metric through simple numerical and housing examples.
What you can do after
Apply it via scikit-learn by taking the square root of mean_squared_error to evaluate regression predictions.
How it connects
Connects mean absolute error, mean square error, linear regression, polynomial regression, regularization, and scikit-learn.

Also explained in

Compare how 10 books explain root mean squared error →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Machine Learning, Second Edition. The section links point to the parts of the book it draws on.