5

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)
Ben Williams
  • 91
  • 1
  • 1
  • 5
  • This is less of a programming question and more of a statistics question; it might be better off at [cross validated](https://stats.stackexchange.com/)! Do you mean you want the RMS error as a percentage of the data value for every data point? – Ari Cooper-Davis Mar 25 '19 at 11:39
  • Thanks, I'll see what they say there! I'm not entirely sure for your question, the report that I want to compare to expresses one value at 71% and the other value, which he says is more accurate, at 75%. – Ben Williams Mar 25 '19 at 12:21

2 Answers2

5

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))
-1
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
Robert
  • 7,394
  • 40
  • 45
  • 64
  • 2
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 04 '23 at 07:03