pub fn jsd(p: &[f64], q: &[f64], bins: usize) -> f64Expand description
Compute Jensen-Shannon divergence between two distributions.
JSD(P,Q) = ½ D_KL(P||M) + ½ D_KL(Q||M) where M = (P+Q)/2
Symmetric, always finite, and its square root is a proper metric. Use for detecting ANY distribution shift (not just mean shift).
§Arguments
p- First distribution’s valuesq- Second distribution’s valuesbins- Number of bins for discretization
§Returns
JSD in bits (symmetric, bounded by log₂(bins)).