Function engram::metrics::jaccard_index

source ·
pub fn jaccard_index(a: &[bool], b: &[bool]) -> f64
Expand description

Compute the Jaccard index between two sets. Formula: |A ∩ B| / |A ∪ B|

§Examples

let a = [true, true, false, false];
let b = [true, false, true, false];
let c = [false, false, false, false];
let ji_ab = jaccard_index(&a, &b);
let ji_ac = jaccard_index(&a, &c);