杰卡德距离
我在计算集合(位向量)的杰卡德距离时遇到这个问题:
p1 = 10111;
p2 = 10011。
交集大小 = 3; (我们怎样才能找到它?)
并集的大小= 4,(我们怎样才能找到它?)
杰卡德相似度=(交集/并集)= 3/4。
杰卡德距离 = 1 –(杰卡德相似度)= (1-3/4) = 1/4。
但我不明白我们如何找出两个向量的“交集”和“并集”。
请帮我。
多谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
p1&p2 = 10011
的设置位数p1|p2 = 10111
的集合位数这里的向量表示二进制数组,其中第 i 位表示第 i 个元素是否存在于这一套。
Amount of set bits of
p1&p2 = 10011
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.
如果 p1 = 10111 且 p2 = 10011,则
p1 和 p2 的每个组合属性的总数:
杰卡德相似系数 = J = 交集/并集 = M11/(M01 + M10 + M11) = 3 / (0 + 1 + 3) = 3/4,
杰卡德距离 = J' = 1 - J = 1 - 3/4 = 1/4,
或 J' = 1 - (M11/(M01 + M10 + M11)) = (M01 + M10)/(M01 + M10 + M11) = (0 + 1)/(0 + 1 + 3) = 1/4
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