# xskillscore.rmse

xskillscore.rmse(a, b, dim=None, weights=None, skipna=False, keep_attrs=False)

Root Mean Squared Error.

$\mathrm{RMSE} = \sqrt{\frac{1}{n}\sum_{i=1}^{n}(a_{i} - b_{i})^{2}}$
Parameters
• a (xarray.Dataset or xarray.DataArray) – Labeled array(s) over which to apply the function.

• b (xarray.Dataset or xarray.DataArray) – Labeled array(s) over which to apply the function.

• dim (str, list) – The dimension(s) to apply the rmse along. Note that this dimension will be reduced as a result. Defaults to None reducing all dimensions.

• weights (xarray.Dataset or xarray.DataArray or None) – Weights matching dimensions of dim to apply during the function.

• skipna (bool) – If True, skip NaNs when computing function.

• keep_attrs (bool) – If True, the attributes (attrs) will be copied from the first input to the new one. If False (default), the new object will be returned without attributes.

Returns

Root Mean Squared Error.

Return type

References

https://en.wikipedia.org/wiki/Root-mean-square_deviation

Examples

>>> a = xr.DataArray(np.random.rand(5, 3, 3), dims=['time', 'x', 'y'])
>>> b = xr.DataArray(np.random.rand(5, 3, 3), dims=['time', 'x', 'y'])
>>> xs.rmse(a, b, dim='time')
<xarray.DataArray (x: 3, y: 3)>
array([[0.30366872, 0.5147618 , 0.57410211],
[0.2963848 , 0.37177283, 0.40563885],
[0.55686111, 0.38189299, 0.21317579]])
Dimensions without coordinates: x, y