{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

Info icon This preview shows pages 1–6. 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
Image of page 1

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

View Full Document Right 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 -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))
Image of page 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
Image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
STA 414/2104 Mar 25, 2010 ... curse I Example: N data points uniformly distributed on a unit ball in R p .
Image of page 5

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

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern