Practical 7: Perform the data clustering using clustering algorithm.
newiris <- iris
newiris$Species <- NULL
(kc <- kmeans(newiris,3))
Step2:
table (iris$Species,kc$cluster)
Step3:
plot(newiris[c("Sepal.Length","Sepal.Width")],col=kc$cluster)
points(kc$centers[,c("Sepal.Length","Sepal.Width")],col=1:3,pch=8,cex=2)
Comments
Post a Comment