reservoirpy.observables.rmse#

reservoirpy.observables.rmse(
y_true: ndarray,
y_pred: ndarray,
dimensionwise: bool = False,
) float[source]#

Root mean squared error metric:

\[\sqrt{\frac{\sum_{i=0}^{N-1} (y_i - \hat{y}_i)^2}{N}}\]
Parameters:
  • y_true (array-like of shape (N, features)) – Ground truth values.

  • y_pred (array-like of shape (N, features)) – Predicted values.

  • dimensionwise (boolean, optional) – If True, return a mean squared error for each dimension of the timeseries

Returns:

  • float – Root mean squared error.

  • If dimensionwise is True, returns a Numpy array of shape $(features, )$.

Return type:

float

Examples

>>> from reservoirpy.nodes import Reservoir, Ridge
>>> model = Reservoir(units=100, sr=1) >> Ridge(ridge=1e-8)
>>> from reservoirpy.datasets import mackey_glass, to_forecasting
>>> x_train, x_test, y_train, y_test = to_forecasting(mackey_glass(1000), test_size=0.2)
>>> y_pred = model.fit(x_train, y_train).run(x_test)
>>> from reservoirpy.observables import rmse
>>> print(rmse(y_true=y_test, y_pred=y_pred))
0.00034475744480521534