Root Mean Squared Error (RMSE)?

Maricel A. Gueco 1 Reputation point
2024-03-27T03:55:34.0466667+00:00

How to compute Root Mean Squared Error (RMSE)? in regression validation prediction?

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,563 questions
{count} votes

1 answer

Sort by: Most helpful
  1. santoshkc 4,190 Reputation points Microsoft Vendor
    2024-03-27T04:11:12.8433333+00:00

    Hi @Maricel A. Gueco,

    Thank you for reaching out to Microsoft Q&A forum!

    To compute the Root Mean Squared Error (RMSE) in regression validation prediction, you can use the mean_squared_error function from the sklearn.metrics library in Python. Here's an example code snippet:

    >>> from sklearn.metrics import mean_squared_error
    >>> y_true = [3, -0.5, 2, 7]
    >>> y_pred = [2.5, 0.0, 2, 8]
    >>> mean_squared_error(y_true, y_pred)
    0.375
    >>> y_true = [[0.5, 1],[-1, 1],[7, -6]]
    >>> y_pred = [[0, 2],[-1, 2],[8, -5]]
    >>> mean_squared_error(y_true, y_pred)
    0.708...
    >>> mean_squared_error(y_true, y_pred, multioutput='raw_values')
    array([0.41666667, 1.        ])
    >>> mean_squared_error(y_true, y_pred, multioutput=[0.3, 0.7])
    0.825...
    

    The RMSE is a measure of the differences between the predicted(y_pred) and actual values(y_true), with lower values indicating better performance.

    See official documentation: sklearn.metrics.mean_squared_error

    Also see the training module of Train and evaluate regression models.

    Hope this helps. Do let us know if you any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful.

    0 comments No comments