首页 > 其他 > 详细

R-kmeans

时间:2014-07-07 19:34:11      阅读:384      评论:0      收藏:0      [点我收藏+]
data <- read.csv("//Users//tangjingxiao//Desktop//2.csv",header=T,sep="\t",encoding="utf-8")
data
fix(data)
View(data)
newdata <- t(data)
view(newdata)
View(newdata)
kc <- kmeans(newdata,30)
kc
plot(newdata,col=kc$cluster)
points(kc$centers, col = 1:2, pch = 8, cex = 2)
ss <- function(y) sum(scale(y, scale = FALSE)^2)
ss
## cluster centers "fitted" to each obs.:
fitted.newdata <- fitted(kc);
head(fitted.newdata);
resid.newdata<- newdata - fitted(kc);
resid

 

R-kmeans,布布扣,bubuko.com

R-kmeans

原文:http://www.cnblogs.com/ilxx1988/p/3813318.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!