rmse

improvelib.metrics.rmse(y_true, y_pred)

Compute Root Mean Squared Error (RMSE). Uses sklearn.metrics.root_mean_square_error() for sklearn v1.4.0 and higher, sklearn.metrics.mean_square_error(squared=False) for sklearn v0.22.0 up to v1.4.0 and the square root of sklearn.metrics.mean_square_error() for lower versions.

Used in compute_metrics and can be used directly.

Parameters:

y_truenp.ndarray

Ground truth.

y_prednp.ndarray

Predictions made by the model.

Returns:

rmsefloat

The computed RMSE.

Example

This function is called by compute_metrics which is called by compute_performance_scores, which also saves the scores.

You can use this function directly, for example during model training like so:

import improvelib.metrics as metr
rmse_to_monitor = metr.rmse(y_true, y_pred)