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.