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:

- Find the difference between actual value and predicted value
- Make a square of this difference
- Add this squared value for all the predicted data points
- Divide the above sum by total number of data points
- 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 !!

Advertisements

## One thought on “What is Root Mean Squared Error or RMSE”