为二进制矢量的数据帧计算相似度矩阵的最佳方法是什么?

问题描述 投票:0回答:1

我有一个二进制数据大小为m x n的数据帧,带有一些未填充的值,例如下面的示例

col1 col2 col3 col4 col5
 V0    1         0    1
 V1    1    1         0
 V2    0    1    0    1
 V3         0    0

我想在此数据帧上计算相似度矩阵,以便获得任意两个向量之间的相似度得分。

最佳方法是什么?

注意:我尝试将NULL值替换为2,并从数据帧上的scipy库应用余弦相似度。结果矩阵不正确/正确。

python binary similarity cosine-similarity
1个回答
0
投票

您可能想将pdistcdist与骰子,jaccard或汉明之类的二进制距离功能一起使用(请参阅the list of these functions at the end of this page

© www.soinside.com 2019 - 2024. All rights reserved.