1 / 20
文档名称:

实验报告-聚类分析.docx

格式:docx   大小:415KB   页数:20页
下载后只包含 1 个 DOCX 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

实验报告-聚类分析.docx

上传人:iris028 2020/7/1 文件大小:415 KB

下载得到文件列表

实验报告-聚类分析.docx

文档介绍

文档介绍:实验报告聚类分析实验原理:K均值聚类、中心点聚类、系统聚类和EM算法聚类分析技术。实验题目:用鸢尾花的数据集,进行聚类挖掘分析。实验要求:探索鸢尾花数据的基本特征,利用不同的聚类挖掘方法,获得基本结论并简明解释。实验题目--分析报告:data(iris)>rm(list=ls())>gc()used(Mb)gctrigger(Mb)maxused(Mb)>data(iris)>data<-iris>head(data)#Kmean聚类分析>newiris<-iris>newiris$Species<-NULL>(kc<-kmeans(newiris,3))K-meansclusteringwith3clustersofsizes62,50,38Clustermeans::[1]2222222222222222222222222222222222222222[41]22222222221131111111111111111**********[81]1111111111111111111131333313333331133331[121]313133113333313333133313331331Withinclustersumofsquaresbycluster:[1](between_SS/total_SS=%)ponents:[1]"cluster""centers""totss""withinss"""[6]"betweenss""size""iter""ifault">table(iris$Species,kc$cluster)123setosa0500versicolor4802virginica14036>plot(newiris[c("","")],col=kc$cluster)>points(kc$centers[,c("","")],col=1:3,pch=8,cex=2)#K-Mediods进行聚类分析>("cluster")>library(cluster)><-pam(iris,3)>table(iris$Species,$clustering)123setosa5000versicolor0347virginica0491>layout(matrix(c(1,2),1,2))>plot()>layout(matrix(1))#hc><-hclust(dist(iris[,1:4]))>plot(,hang=-1)>plclust(,labels=FALSE,hang=-1)>re<-(,k=3)><-cutree(,3)#利用剪枝函数cutree()参数h控制输出height=18时的系谱类别>sapply(unique(),+function(g)iris$Species[==g])[[1]][1]setosasetosasetosasetosasetosasetosasetosasetosasetosasetosasetosa[12]setosasetosasetosasetosasetosasetosasetosasetosasetosasetosasetosa[23]setosasetosasetosasetosasetosasetosasetosasetosasetosasetosasetosa[34]setosasetos