http://rischanlab.github.io/Kmeans.html
K means Clustering in R example Iris Data
Created by
Rischan Mafrur
Chonnam National University of South Korea
May 27, 2014
In this tutorial I want to show you how to use K means in R with Iris Data example.
We can show the iris data with this command, just type "iris" for show the all data :
Or we can use command "names" for show the label/column names
In this we assign the data from column 1-4 (features) to variable x, and the class to variable y
Create kmeans model with this command: (You need to put the number how many cluster you want, in this case I use 3 because we already now in iris data we have 3 classes)
type "kc" or kmeans model for show summary
After we know the result, we need to know how many error and missing data, so we need to compare the clustering result with the species/classes iris data.
we use table for comapre:
For plotting we can use plot function, In this case I plot the Sepal length as x-axis and Sepal Width as y-axis, you can choose different.
'Data Mining & R' 카테고리의 다른 글
K-nearest Neighbors를 이용한 주식시장 예측 (0) | 2016.04.27 |
---|---|
K-means 예제 with R (0) | 2016.04.24 |
K-means (0) | 2016.04.24 |
[JAVA] Weka 라이브러리를 활용하여 KNN 사용하기 (1) | 2016.04.20 |
SVM , discriminant analysis, KNN 실습 (0) | 2016.04.20 |