Function jaccard_union

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

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

§Arguments

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

§Returns

The Jaccard union 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 union = intspan::jaccard_union(&a, &b);
assert_eq!(union, 80.0);