Is there a library function for Root mean square error (RMSE) in python?

Machine Learning

I know I could implement a root mean squared error function like this:

def rmse(predictions, targets): 

return np.sqrt(((predictions - targets) ** 2).mean())

 

What I'm looking for if this rmse function is implemented in a library somewhere, perhaps in scipy or scikit-learn?


If you want to unleash your potential in this competitive field, please visit the Machine Learning course page for more information, where you can find the Machine Learning tutorials and Machine Learning frequently asked interview questions and answers as well.

3
Answers

Replies

 


 


 


Root Mean Squared Error (RMSE) is one of the library function, referred to the quadratic scoring rule which helps in measuring the average magnitude of the error. In simple terms, it is defined as the square root of the average squared differences between the prediction and the actual observations.


 


 


 


When it comes to the scikit learn library, sklearn.metrics has come up with a function called mean_squared_error function.


 

 

You can pass the argument squared=False to the mean_squared_error() to get the RMSE.



from sklearn.metrics import mean_squared_error



mean_squared_error(y_actual, y_predicted, squared=False)

 
 

This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.
To Top