reservoirpy.observables.mse#
- reservoirpy.observables.mse( ) float[source]#
Mean squared error metric:
\[\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 – Mean squared error.
If dimensionwise is True, returns a Numpy array of shape $(features, )$.
- Return type:
Examples
>>> from reservoirpy.nodes import ESN >>> 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 = ESN(units=100, sr=1).fit(x_train, y_train).run(x_test)
>>> from reservoirpy.observables import mse >>> print(mse(y_true=y_test, y_pred=y_pred)) 0.03962918253990291