Skip to main content

get_mutual_info

Function get_mutual_info 

Source
pub fn get_mutual_info(
    x: &[f64],
    y: &[f64],
    n_bins: Option<usize>,
    normalize: bool,
) -> CodependenceResult<f64>
Expand description

Mutual information I[X;Y] = H[X] + H[Y] - H[X,Y] of x and y, estimated from an n_bins x n_bins equal-width histogram.

n_bins = None uses get_optimal_number_of_bins with the sample correlation. With normalize = true the result is divided by min(H[X], H[Y]) and lies in [0, 1]. The histogram estimate is biased upward on small samples; compare values only at equal length and binning. Normalised mutual information is not a distance; use variation_of_information_score for clustering.

ยงErrors