jaccard_m.Rd
multiset jaccard for two sets A and B
jaccard_m(vec1, vec2)
vec1 | A vector |
---|---|
vec2 | A vector |
A number
Let n(a,A) be the number of occurences of element a in multiset A. definition: numerator/denominator where numerator = sum( min( n(a,A) , n(a,B) ) for every a in union(A,B)) and denominator = sum( max( n(a,A) , n(a,B) ) for every a in union(A,B))
set.seed(1); A = sample(letters, 100, TRUE) set.seed(2); B = sample(letters, 100, TRUE) jaccard_m(A, B)#> [1] 0.5873016