Computing the root mean squared error

You may build a regression model and want to evaluate the model by comparing the model's predictions with the actual outcomes. You will generally evaluate a model's performance on the training data, but will rely on the model's performance on the hold out data to get an objective measure.

Getting ready

If you have not already downloaded the files for this chapter, do so now and ensure that the rmse.csv file is in your R working directory. The file has data about a set of actual prices and the predicted values from some regression method. We will compute the root mean squared (RMS) error of these predictions.

How to do it...

When using any regression technique, you will be able to generate predictions. This recipe ...

Get R: Recipes for Analysis, Visualization and Machine Learning now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.