Ben Williams
Ben Williams

Reputation: 101

How to express Root Mean Squared Error as a percentage?

I want to compare the result of my prediction with that of another person's prediction. In the article, the author says 'The relative percentage of root mean square (RMS%) was used to evaluate the performance'. This is what I want to compare my prediction to.

Currently I'm calculating the root mean square error, however I don't understand how to express this as a percentage

This is how I calculate my root mean square error using Python

rmse = math.sqrt(mean_squared_error(y_test,y_predict)

Upvotes: 5

Views: 23109

Answers (2)

MUHAMMAD FAIZAN
MUHAMMAD FAIZAN

Reputation: 11

from sklearn.metrics import mean_squared_error

rmse = np.sqrt(mean_squared_error(actual_values, predictions))

target_range = np.max(actual_values) - np.min(actual_values)

percentage_accuracy = (1.0 - (rmse / target_range)) * 100

Upvotes: 0

Vladyslav Didukh
Vladyslav Didukh

Reputation: 126

Use numpy lib in order to calculate rmspe (How to calculate RMSPE in python using numpy):

rmspe = np.sqrt(np.mean(np.square(((y_true - y_pred) / y_true)), axis=0))

Upvotes: 7

Related Questions