{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# mar25 - STA 414/2104 k-means clustering km15 =...

This preview shows pages 1–6. Sign up to view the full content.

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

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

View Full Document
-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 -2 -1 0 1 2 3 kmeans with 5 cluster centers x1 x2 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))
STA 414/2104 Mar 25, 2010 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 want 10% of the sample in R p : need a box with edge length 0 . 1 1 / 10 = 0 . 80 I on each axis need a window of length 0.8. I Figure 2.6 3 / 16

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

View Full Document
STA 414/2104 Mar 25, 2010 ... curse I Example: N data points uniformly distributed on a unit ball in R p .

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern