如何使用病区法更新聚集聚类中的邻近矩阵?

时间:2020-07-17 14:24:18

标签: matrix python-3.7 distance hierarchical-clustering linkage

我想使用ward方法实现聚集聚类,以实现平衡的树状图,所以我并不太了解它的工作原理(ward方法),在合并两个拖车簇之后如何更新距离,请举一个简单的示例帮助您: 数据包含6个元素(e1,e2,e3,e4,e5,e6),其中:

    distMatrix = [[0, 25, 7, 10, 51, 33],
         [0, 0, 18, 9, 49, 21],
         [0, 0, 0, 5, 13, 20],
         [0, 0, 0, 0, 2, 15],
         [0, 0, 0, 0, 0, 28]
         [0, 0, 0, 0, 0, 0]]

在第一次迭代中,最接近的元素是minDistance = 2的(e5,e4) 更新的disMatrix将包含e1,e2,e3,e6,newCluster

distMatrix = [[0, 25, 7, 33, newValue],
      [0, 0, 18, 21, newValue],
      [0, 0, 0, 20, newValue],
      [0, 0, 0, 0, newValue],
      [0, 0, 0, 0, 0]]

那么如何使用ward方法来计算newValues?

0 个答案:

没有答案
相关问题