【发布时间】:2015-08-30 03:50:03
【问题描述】:
我正在做一些 kmeans 聚类:
无论我选择使用多少个聚类,点变异的百分比都不会改变:
这是我绘制数据的方式:
# Prepare Data
mydata <- read.csv("~/student-mat.csv", sep=";")
# Let's only grab the numeric columns
mydata <- mydata[,c("age","Medu","Fedu","traveltime","studytime","failures","fam
mydata <- na.omit(mydata) # listwise deletion of missing
mydata <- scale(mydata) # standardize variables ibrary(ggplot2)
# K-Means Clustering with 5 clusters
fit <- kmeans(mydata, 5) #to change number of clusters, I change the "5"
# Cluster Plot against 1st 2 principal components
# vary parameters for most readable graph
library(cluster)
clusplot(mydata, fit$cluster, color=TRUE, shade=TRUE,
labels=0, lines=0)
我们如何影响点变异的百分比?
【问题讨论】:
标签: r statistics cluster-analysis k-means