def rmse(predictions, targets):
"""Calculate the root mean squared error of an array of predictions.
Parameters
----------
predictions : array_like
Array of predicted values.
targets : array_like
Array of target values.
Returns
-------
rmse: float
Root mean squared error of the predictions wrt the targets.
"""
predictions = np.asanyarray(predictions)
targets = np.asanyarray(targets)
rmse = np.sqrt(np.nanmean((predictions - targets) ** 2))
return rmse
评论列表
文章目录