Function jaccard_intersection

Source
pub fn jaccard_intersection(a: &[f32], b: &[f32]) -> f32
Expand description

Computes the Jaccard intersection of two vectors a and b. The Jaccard intersection is the sum of the minimum values of corresponding elements.

§Arguments

  • a - The first vector.
  • b - The second vector.

§Returns

The Jaccard intersection of a and b.

§Examples

let a = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0];
let b = [10.0, 9.0, 8.0, 7.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0];
let intersection = intspan::jaccard_intersection(&a, &b);
assert_eq!(intersection, 30.0);