pub fn estimate_random_guessing(labels: &ArrayView1<usize>) -> f64 {
    let mut counts = HashMap::new();
    let mut max_count = 0;

    for y in labels {
        let count = counts.entry(y).or_insert(0);
        *count += 1;
        if *count > max_count {
            max_count = *count;
        }
    }

    1. - f64::from(max_count) / (labels.len() as f64)
}
/// Estimates the priors on a vector of labels, and computes the
/// random guessing error as 1 - max priors.
Estimates the priors on a vector of labels, and computes the
random guessing error as 1 - max priors.
Estimates the priors on a vector of labels and computes the random guessing error as 1 - max priors .
pub fn estimate_random_guessing(labels: &ArrayView1<usize>) -> f64 {
    let mut counts = HashMap::new();
    let mut max_count = 0;
    for y in labels {
        let count = counts.entry(y).or_insert(0);
        *count += 1;
        if *count > max_count {
            max_count = *count;
        }
    }
    1. - f64::from(max_count) / (labels.len() as f64)
}
pub fn estimate_random_guessing ( labels : & ArrayView1 < usize > ) -> f64 { let mut counts = HashMap :: new ( ) ; let mut max_count = 0 ; for y in labels { let count = counts . entry ( y ) . or_insert ( 0 ) ; * count += 1 ; if * count > max_count { max_count = * count ; } } 1. - f64 :: from ( max_count ) / ( labels . len ( ) as f64 ) }
Estimates the priors on a vector of labels, and computes the
random guessing error as 1 - max priors.
Estimates the priors on a vector of labels and computes the random guessing error as 1 - max priors .
labels
&ArrayView1<usize>
labels
&ArrayView1<usize>