Module smartcore::metrics::mean_squared_error
source · Expand description
Mean squared error regression loss.
Mean Squared Error
MSE 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}} (y_i - \hat{y_i})^2 \]
where \(\hat{y}\) are predictions and \(y\) are true target values.
Example:
use smartcore::metrics::mean_squared_error::MeanSquareError;
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 = MeanSquareError::new().get_score( &y_true, &y_pred);
Structs
- Mean Squared Error