



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




In [45]: In [46]: In [65]: Out[46]: Variable 1 Variable 2 0 2.00 2. 1 5.50 4. 2 5.00 5. 3 1.50 2. 4 1.00 1. 5 7.00 5. 6 5.75 6. import numpy as np import pandas as pd import matplotlib.pyplot as plt import scipy data = pd.read_excel
("C:/Users/kriti/OneDrive/Desktop/machine Learning/experiments/hierarchical_clustering.xlsx") data fig = plt.figure(figsize = ( 5 , 5 )) x = data["Variable 1"] y = data["Variable 2"] n = range( 0 , 7 ) plt.grid() plt.scatter(x, y, marker = 'o', c = 'red' ) plt.xlabel('Variable_1') plt.ylabel('Variable_2') for i, txt in enumerate(n): plt.annotate(txt, (x[i], y[i]))
In [12]: In [12]: Out[4]: 0 2. 1 5. 2 5. 3 1. 4 1. 5 7. 6 5. Name: Variable 1, dtype: float Out[12]:
x = data["Variable 1"] x x[ 1 ] # how many clusters, draw a dendrogram #linkage-single from scipy.cluster.hierarchy import dendrogram, linkage
In [40]: In [111]: In [41]: Out[18]: array([1, 0, 0, 1, 1, 0, 0], dtype=int64)