Open anna0207 opened 6 years ago
R-code example for create dendrogram with hierarchical clustering:
library(cluster) library(dendextend)
data.norm <- scale(data)
fun <- function(x) as.dist((1-cor(t(x)))/2)
data.dis <- fun(data.norm)
data.hclust <- hclust(data.dis, method="ward.D2")
plot(data.hclust) plot(as.dendrogram(data.hclust)) plot(as.dendrogram(agnes(data))) plot(as.dendrogram(diana(data)))
3.2.1: Show level dendrogram containing 5 instances of each digit (one person)
3.2.2: Use K-Mean clustering to compress each digit into 5 clusters, as done in 3.1.1, and perform hierarchical clustering to show a low level dendrogram of this (one person).
3.2.3: Discuss the results and relate them to the cross validation tables from k-NN classification.