Expand description

Mean absolute error regression loss.

Mean Absolute Error

MAE measures the average magnitude of the errors in a set of predictions, without considering their direction.

\[mse(y, \hat{y}) = \frac{1}{n_{samples}} \sum_{i=1}^{n_{samples}} \lvert y_i - \hat{y_i} \rvert \]

where \(\hat{y}\) are predictions and \(y\) are true target values.

Example:

use smartcore::metrics::mean_absolute_error::MeanAbsoluteError;
use smartcore::metrics::Metrics;
let y_pred: Vec<f64> = vec![3., -0.5, 2., 7.];
let y_true: Vec<f64> = vec![2.5, 0.0, 2., 8.];

let mse: f64 = MeanAbsoluteError::new().get_score( &y_true, &y_pred);

Structs