Skip to content

Instantly share code, notes, and snippets.

@yumaueno
Last active July 4, 2019 14:34
Show Gist options
  • Save yumaueno/f88f9eb3b1c8030f9d20c3e032dc74c9 to your computer and use it in GitHub Desktop.
Save yumaueno/f88f9eb3b1c8030f9d20c3e032dc74c9 to your computer and use it in GitHub Desktop.
data<-iris
data_train<-data[,-5]#5列目はラベルなので削除
km<-kmeans(data_train,3)
km$cluster
table(data[,5],km$cluster)#本物のラベルとグループ分けを比較
# ----xmeans------
xm<-xmeans(data_train,3)
table(data[,5],xm$cluster)#本物のラベルとグループ分けを比較
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment