我使用模塊hcluster從距離矩陣計算樹狀圖。我的距離矩陣是這樣生成的數組的數組: import hcluster
import numpy as np
mols = (..a list of molecules)
distMatrix = np.zeros((10, 10))
for i in range(0,10):
for j in range(0,10):
我必須通過運行創建載體列表: import hcluster
import numpy as np
from ete2 import Tree
vecs = [np.array(i) for i in document_list]
其中document_list是網頁文件,我分析的集合。然後我進行聚類: Z = hcluster.linkage(vecs, metric='cosine