mean_absolute_error()

audmetric.mean_absolute_error(truth, prediction)[source]

Mean absolute error.

MAE=1ni=1npredictiontruth\text{MAE} = \frac{1}{n} \sum^n_{i=1} |\text{prediction} - \text{truth}|
Parameters:
  • truth (Sequence[float]) – ground truth values

  • prediction (Sequence[float]) – predicted values

Return type:

float

Returns:

mean absolute error

Raises:

ValueError – if truth and prediction differ in length

Examples

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