Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Hierarchical Clustering

121 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Hierarchical Clustering

  1. 1. Kelly Chan | Dec 5 2013 Hierarchical Clustering X dist() hclust() as.matrix() plot() heatmap() data.frame(x,y) Y plot(x,y) Distances – dist() (1) Continuous -> Euclidean distance set.seed(124); par(mar=c(0,0,0,0)) x <- rnorm(20,mean=rep(1:3,each=4),sd=0.5) y <- rnorm(20,mean=rep(c(1,2,1),each=4),sd=0.5) plot(x,y,col="blue",pch=19,cex=2) text(x+0.05,y+0.05,labels=as.character(1:20)) √((x −x ) +( y − y ) ) 2 1 2 2 1 2 (2) Binary -> Manhattan distance ∣x 1 −x 2∣+∣ y1 − y2∣ (3) Continuous – Correlation Similarity dataFrame <- data.frame(x=x,y=y) distxy <- dist(dataFrame) hClustering <- hclust(distxy) plot(hClustering) dataFrame <- data.frame(x=x,y=y) set.seed(1344) dataMatrix <- as.matrix(dataFrame)[sample(1:20),] heatmap(dataMatrix)

×