I have this problem in calculating Jaccard Distance for Sets (Bit-Vectors):
p1 = 10111;
p2 = 10011.
Size of intersection = 3; (How could we find it out?)
Size of union = 4, (How could we find it out?)
Jaccard similarity = (intersection/union) = 3/4.
Jaccard Distance = 1 – (Jaccard similarity) = (1-3/4) = 1/4.
But I don't understand how could we find out the "intersection" and "union" of the two vectors.
Please help me.
Thanks alot.
Size of intersection = 3; (How could we find it out?)
Amount of set bits of p1&p2 = 10011
Size of union = 4, (How could we find it out?)
Amount of set bits of p1|p2 = 10111
Vector here means binary array where i-th bit means does i-th element present in this set.
If p1 = 10111 and p2 = 10011,
The total number of each combination attributes for p1 and p2:
Jaccard similarity coefficient = J = intersection/union = M11/(M01 + M10 + M11) = 3 / (0 + 1 + 3) = 3/4,
Jaccard distance = J' = 1 - J = 1 - 3/4 = 1/4, Or J' = 1 - (M11/(M01 + M10 + M11)) = (M01 + M10)/(M01 + M10 + M11) = (0 + 1)/(0 + 1 + 3) = 1/4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With