colour.utilities.metric_mse

colour.utilities.metric_mse(a: ArrayLike, b: ArrayLike, axis: Optional[Union[Integer, Tuple[Integer]]] = None) FloatingOrNDArray[source]

Compute the mean squared error (MSE) or mean squared deviation (MSD) between given variables \(a\) and \(b\).

Parameters
  • a (ArrayLike) – Variable \(a\).

  • b (ArrayLike) – Variable \(b\).

  • axis (Optional[Union[Integer, Tuple[Integer]]]) – Axis or axes along which the means are computed. The default is to compute the mean of the flattened array. If this is a tuple of ints, a mean is performed over multiple axes, instead of a single axis or all the axes as before.

Returns

Mean squared error (MSE).

Return type

numpy.floating or numpy.ndarray

References

[Wikipedia03d]

Examples

>>> a = np.array([0.48222001, 0.31654775, 0.22070353])
>>> b = a * 0.9
>>> metric_mse(a, b)  
0.0012714...