# -*- coding: utf-8 -*-
'''
Created on 2018年1月25日
@author: Jason.F
@summary: 无监督聚类学习-层次聚类(hierarchical clustering),自下向上的凝聚和自顶向下的分裂两种方法。
'''
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial.distance import pdist,squareform
from scipy.cluster.hierarchy import linkage
from scipy.cluster.hierarchy import dendrogram
from sklearn.cluster import AgglomerativeClustering
np.random.seed(123)
variables = ['X','Y','Z']
labels=['ID_0','ID_1','ID_2','ID_3','ID_4']
X=np.random.random_sample([5,3])*10
#层次聚类树
df = pd.DataFrame(X,columns=variables,index=labels)
print (df)
#计算距离关联矩阵,两两样本间的欧式距离
#row_dist = pd.