 # What is Root Mean Squared Error or RMSE

Root mean squared error or RMSE is a measure of the difference between actual values and predicted values of a machine learning model  like Linear Regression.

Root mean squared error is a measure of how well the machine learning model can perform. The lower the RMSE, the better the model.

RMSE is always positive, and a value of 0 for RMSE indicates a perfect fit to the data as shown in the image above.

RMSE is calculated as below:

1. Find the difference between actual value and predicted value
2. Make a square of this difference
3. Add this squared value for all the predicted data points
4. Divide the above sum by total number of data points
5. Find the square root of the above result.

How to calculate RMSE using sklearn:

``````from sklearn.metrics import mean_squared_error
rmse = np.sqrt(mean_squared_error(y_true, y_pred))``````

There is a related term for measuring how good a Linear Regression model fits the data, know as R-squared.

Cheers !!