mean_absolute_error#
- rojak.turbulence.metrics.mean_absolute_error(truth: Array, prediction: Array) float[source]#
Mean Absolute Error (MAE)
\[MAE(y, \hat{y}) = \frac{1}{n_{samples}} \sum_{i=0}^{n_{samples} - 1} | y_i - \hat{y_i} |\]where \(n_{samples}\) is the number of samples, \(y_i\) is the truth value and \(\hat{y_i}\) is the corresponding predicted value.
Returns:
Examples
This example is modified from the scikit-learn’s user guide on MAE
>>> y_true = da.asarray([3, -0.5, 2, 7]) >>> y_pred = da.asarray([2.5, 0.0, 2, 8]) >>> float(mean_absolute_error(y_true, y_pred).compute()) 0.5