2014-10-28 1 views
2

Scipy 계층 적 클러스터링을 사용하여 다음과 같은 방식으로 클러스터되는 많은 데이터 요소가 있습니다. 내가 '1500'레벨에서 덴도 그램을 제거하고 싶다고합시다. 그렇게하는 방법? 모든 하위 다음, 클러스터 노드가 color_threshold 미만인 경우, the scipy documentation에 지정된대로Scipy 계층 적 클러스터링의 수준에서 프래 밍 dendrogram

Z = dendrogram(linkage_matrix, 
      truncate_mode='lastp', 
      color_threshold=1, 
      labels=df.session.tolist(), 
      distance_sort='ascending') 


plt.title("Hierachical Clustering") 
plt.show() 

Results

답변

0

(I는 'P'매개 변수를 사용하여 시도하고 그것이 내가 기대하고있어되지 않습니다) 같은 색 (파란색이 아님)이됩니다. color_threshold 위의 노드를 연결하는 링크는 파란색입니다.

예제에서 color_threshold=1. 모든 노드가 1 위에 있기 때문에 모든 링크가 파란색입니다.

대신

Z = dendrogram(linkage_matrix, 
     color_threshold=1500, 
     distance_sort='ascending') 
시도