rmse#
- class braintools.fit.losses.rmse(prediction, target)#
Compute the root-mean-square error between two time series.
\[\mathrm{RMSE} = \sqrt{\frac{1}{M} \sum_{i=1}^{M} (\hat y_i - y_i)^2}.\]- Parameters:
- Returns:
Scalar RMSE; for Quantity inputs the plain magnitude in the prediction’s unit.
- Return type:
Array- Raises:
ValueError – If the shapes differ.
TypeError – If only one input carries units.
brainunit.UnitMismatchError – If the units have different dimensions.
Notes
The same numerics as
brainmass.objectives.timeseries_rmse. Works underjax.jitandjax.vmapand is differentiable; at a perfect fit the gradient is 0 rather thannan.Examples
>>> import jax.numpy as jnp >>> from braintools.fit import losses >>> x = jnp.zeros((10, 3)) >>> float(losses.rmse(x + 2., x)) 2.0