mar25 - STA 414/2104 Mar 25, 2010 k -means clustering km15 =

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
STA 414/2104 Mar 25, 2010 k -means clustering km15 = kmeans(x[g==0,],5) km25 = kmeans(x[g==1,],5) for(i in 1:6831){ md = c(mydist(xnew[i,],km15$center[1,]),mydist(xnew[i,],km15$center[2, ] mydist(xnew[i,],km15$center[3,]),mydist(xnew[i,],km15$center[4,]), mydist(xnew[i,],km15$center[5,]),mydist(xnew[i,],km25$center[1,]), mydist(xnew[i,],km25$center[2,]),mydist(xnew[i,],km25$center[3,]), mydist(xnew[i,],km25$center[4,]),mydist(xnew[i,],km25$center[5,])) mark = which(md == min(md)) nearest[i] = ifelse(mark <= 5, "blue", "orange")} plot(xnew, type="n", xlab = "x1", ylab = "x2", main= "kmeans with 5 cluster centers") points(xnew, col=nearest, pch=".") points(km25$centers, col="orange", pch=19, cex=2) points(km15$centers, col="blue", pch=19, cex=2) points(x, col= ifelse(g==0, "blue","orange")) 1/16
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
-2 -1 0 1 2 3 4 -2 -1 0 1 2 3 kmeans with 2 cluster centers x1 x2 -2 -1 0 1 2 3 4 kmeans with 5 cluster centers x1 data(mixture.example) p.16: m 1 k N 2 { ( 1 , 0 ) 0 , I } , k = 1 , . . . , 10 ; m 2 k N 2 { ( 0 , 1 ) 0 , I } , k = 1 , . . . , 10 bluex <- mvrnorm(100, mu = m1[sample(10,1),], Sigma = matrix(c(1,0,0,1),ncol=2))
Background image of page 2
The curse of dimensionality ( § 2.5) I “local” in R 1 is quite different than local in R p I Example: each feature variable uniformly distributed on ( 0 , 1 ) . I want 10% of the sample in R 1 : need a window of length 0.1. I
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 08/12/2010.

Page1 / 16

mar25 - STA 414/2104 Mar 25, 2010 k -means clustering km15 =

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online