mean_squared_error()

audmetric.mean_squared_error(truth, prediction)[source]

Mean squared error.

MSE=1ni=1n(predictiontruth)2\text{MSE} = \frac{1}{n} \sum^n_{i=1} (\text{prediction} - \text{truth})^2
Parameters
  • truth (Sequence[float]) – ground truth values

  • prediction (Sequence[float]) – predicted values

Return type

float

Returns

mean squared error

Raises

ValueError – if truth and prediction differ in length

Examples

>>> mean_squared_error([0, 0], [0, 1])
0.5