熱線電話:13121318867

登錄
首頁精彩閱讀R語言聚類分析
R語言聚類分析
2017-02-20
收藏

R語言聚類分析

聚類分析有很多種, 效果好不好大概要根據數據特征來確定。最常見的是kmeans法聚類
> setwd("D:\\R_test")
> data_in <- read.delim("tmp_result.txt", header=T)
> fit <- kmeans(data_in, 3)
> library(cluster)
> clusplot(data_in, fit$cluster, color=T, shade=T, labels = 2, lines =0)
也可以用mclust

> install.packages("mclust")
試開URL’http://cloud.r-project.org/bin/windows/contrib/2.14/mclust_4.0.zip'
Content type 'application/zip' length 2371233 bytes (2.3 Mb)
打開了URL
downloaded 2.3 Mb

程序包‘mclust’打開成功,MD5和檢查也通過

下載的程序包在
        C:\Users\Administrator\AppData\Local\Temp\RtmpiIyw2o\downloaded_packages里
> fit <- Mclust(data_in)數據分析培訓       
> summary(fit)
----------------------------------------------------
Gaussian finite mixture model fitted by EM algorithm
----------------------------------------------------

Mclust XXX (elliposidal multivariate normal) model with 1 component:

 log.likelihood   n    df     BIC
        1616504 263 33410 3046843

Clustering table:
  1
263

> fit$  // 按下Tab鍵,有以下選項
fit$call           fit$modelName      fit$n              fit$d              fit$G              
fit$BIC            fit$bic            fit$loglik         fit$df             fit$parameters     
fit$classification fit$uncertainty

> plot(fit, what="classification")

數據分析咨詢請掃描二維碼

若不方便掃碼,搜微信號:CDAshujufenxi

數據分析師資訊
更多

OK
客服在線
立即咨詢
日韩人妻系列无码专区视频,先锋高清无码,无码免费视欧非,国精产品一区一区三区无码
客服在線
立即咨詢