pub fn sq_correlation(ground_truth: &[f64], predicted: &[f64]) -> f64 {
    let pred_mean: f64 = predicted.iter().fold(0.0, |a, x| a + x) / predicted.len() as f64;
    let (res_sum_sq, tot_sum_sq) = ground_truth.iter()
        .zip(predicted.iter())
        .fold((0.0, 0.0), |(r, t), (gt, pr)| (r + (gt - pr).powi(2),
                                              t + (gt - pred_mean).powi(2)));
    1.0 - (res_sum_sq / tot_sum_sq)
}
/// The squared correlation coefficient ( R^2 ). Regression problems only.
The squared correlation coefficient ( R^2 ). Regression problems only.
The squared correlation coefficient ( R^2 ) . Regression problems only .
pub fn sq_correlation(ground_truth: &[f64], predicted: &[f64]) -> f64 {
    let pred_mean: f64 = predicted.iter().fold(0.0, |a, x| a + x) / predicted.len() as f64;
    let (res_sum_sq, tot_sum_sq) = ground_truth.iter()
        .zip(predicted.iter())
        .fold((0.0, 0.0), |(r, t), (gt, pr)| (r + (gt - pr).powi(2),
                                              t + (gt - pred_mean).powi(2)));
    1.0 - (res_sum_sq / tot_sum_sq)
}
pub fn sq_correlation ( ground_truth : & [ f64 ] , predicted : & [ f64 ] ) -> f64 { let pred_mean : f64 = predicted . iter ( ) . fold ( 0.0 , | a , x | a + x ) / predicted . len ( ) as f64 ; let ( res_sum_sq , tot_sum_sq ) = ground_truth . iter ( ) . zip ( predicted . iter ( ) ) . fold ( ( 0.0 , 0.0 ) , | ( r , t ) , ( gt , pr ) | ( r + ( gt - pr ) . powi ( 2 ) , t + ( gt - pred_mean ) . powi ( 2 ) ) ) ; 1.0 - ( res_sum_sq / tot_sum_sq ) }
The squared correlation coefficient ( R^2 ).
The squared correlation coefficient ( R^2 ) .
ground_truth
&[f64]
predicted
&[f64]
ground_truth
&[f64]
predicted
&[f64]