pub fn explained_variance_score<F, S1, S2, D1, D2>(
y_true: &ArrayBase<S1, D1>,
y_pred: &ArrayBase<S2, D2>,
) -> Result<F>Expand description
Calculates the explained variance score
Explained variance measures the proportion to which a model accounts for the variation in the target variable.
§Arguments
y_true- Ground truth (correct) target valuesy_pred- Estimated target values
§Returns
- The explained variance score
§Examples
use scirs2_core::ndarray::array;
use scirs2_metrics::regression::explained_variance_score;
let y_true = array![3.0, -0.5, 2.0, 7.0];
let y_pred = array![2.5, 0.0, 2.0, 8.0];
let score = explained_variance_score(&y_true, &y_pred).unwrap();
assert!(score > 0.9);