-
Notifications
You must be signed in to change notification settings - Fork 17
/
dend_visualization.py
33 lines (28 loc) · 950 Bytes
/
dend_visualization.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import matplotlib.pyplot as plt
import scipy.cluster.hierarchy as shc
from sklearn.datasets import load_breast_cancer
from load_dataset import LoadDataset
bc_data = LoadDataset(which='bc')
ildp_data = LoadDataset(which='ildp')
hp_data = LoadDataset(which='hp')
plt.figure(figsize=(5, 4))
#plt.title("Dendograms")
clust = shc.linkage(bc_data.data.data, method='ward')
dend = shc.dendrogram(clust)
filename= 'results/dendrogram_bc.pdf'
plt.savefig(filename, bbox_inches='tight')
plt.show()
plt.figure(figsize=(5, 4))
#plt.title("Dendograms")
clust = shc.linkage(hp_data.data.data, method='ward')
dend = shc.dendrogram(clust)
filename= 'results/dendrogram_ildp.pdf'
plt.savefig(filename, bbox_inches='tight')
plt.show()
plt.figure(figsize=(5, 4))
#plt.title("Dendograms")
clust = shc.linkage(ildp_data.data.data, method='ward')
dend = shc.dendrogram(clust)
filename= 'results/dendrogram_hp.pdf'
plt.savefig(filename, bbox_inches='tight')
plt.show()