Experiment 8: Agglomerative hierarchal clustering
- Consider a dataset “hclustdata.csv” and apply agglomerative hierarchal clustering on it. Data link:https://bit.ly/2Hb4Sk4 .
- Apply using single link ( Min ) technique.
- Apply using complete link (Max) technique.
- Apply using group average technique.
Note: Use Euclidean distance to compute proximity matrix. Check weather 14th entry and 16th entry are similar or not
Step 1: Import the package.
library("cluster")
Step 2: Import the dataset
m<-read.csv("C:/Users/pradeep/OneDrive/datasets/hclustdata.csv")
head(m)
## Name Gender SSC.Perc.entage inter.Diploma.perc
## 1 ARIGELA AVINASH M 87.30 65.3
## 2 BALADARI KEERTHANA F 89.00 92.4
## 3 BAVIRISETTI PRAVALIKA F 67.00 68.0
## 4 BODDU SAI BABA M 71.00 70.4
## 5 BONDAPALLISRINIVAS M 67.00 65.5
## 6 CH KANAKARAJU M 81.26 68.0
## B.Tech.perc Back.logs
## 1 40.00 18
## 2 71.45 0
## 3 45.26 13
## 4 36.47 17
## 5 42.52 17
## 6 62.20 6
Step 3a: Apply Agglomerative hierarchal clustering with group single link (min technique)
clust1<-agnes(x = m,stand = TRUE,metric = "euclidean",method = "single")
pltree(clust1)

m[c(14,16),] # Check whether 14 and 16 are in same cluster or not
## Name Gender SSC.Perc.entage inter.Diploma.perc B.Tech.perc
## 14 EDARA ROJA F 87.10 88.7 74.96
## 16 GADIPALLI MADHURI F 85.83 87.0 75.96
## Back.logs
## 14 0
## 16 0
Step 3b: Apply Agglomerative hierarchal clustering with group complete link (complete technique)
clust2<-agnes(x = m,stand = TRUE,metric = "euclidean",method = "complete")
pltree(clust2)

m[c(14,16),] # Check whether 14 and 16 are in same cluster or not
## Name Gender SSC.Perc.entage inter.Diploma.perc B.Tech.perc
## 14 EDARA ROJA F 87.10 88.7 74.96
## 16 GADIPALLI MADHURI F 85.83 87.0 75.96
## Back.logs
## 14 0
## 16 0
Step 3b: Apply Agglomerative hierarchal clustering with group group average
clust3<-agnes(x = m,stand = TRUE,metric = "euclidean",method = "average")
pltree(clust3)

m[c(14,16),] # Check whether 14 and 16 are in same cluster or not
## Name Gender SSC.Perc.entage inter.Diploma.perc B.Tech.perc
## 14 EDARA ROJA F 87.10 88.7 74.96
## 16 GADIPALLI MADHURI F 85.83 87.0 75.96
## Back.logs
## 14 0
## 16 0