欢迎来到冰点文库! | 帮助中心 分享价值,成长自我!
冰点文库
全部分类
  • 临时分类>
  • IT计算机>
  • 经管营销>
  • 医药卫生>
  • 自然科学>
  • 农林牧渔>
  • 人文社科>
  • 工程科技>
  • PPT模板>
  • 求职职场>
  • 解决方案>
  • 总结汇报>
  • ImageVerifierCode 换一换
    首页 冰点文库 > 资源分类 > DOCX文档下载
    分享到微信 分享到微博 分享到QQ空间

    实验报告 聚类分析.docx

    • 资源ID:5996299       资源大小:379.49KB        全文页数:26页
    • 资源格式: DOCX        下载积分:3金币
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录
    二维码
    微信扫一扫登录
    下载资源需要3金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP,免费下载
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    实验报告 聚类分析.docx

    1、实验报告 聚类分析实验报告 聚类分析实验原理:K均值聚类、中心点聚类、系统聚类和EM算法聚类分析技术。实验题目:用鸢尾花的数据集,进行聚类挖掘分析。实验要求:探索鸢尾花数据的基本特征,利用不同的聚类挖掘方法,获得基本结论并简明解释。实验题目-分析报告:data(iris) rm(list=ls() gc() used (Mb) gc trigger (Mb) max used (Mb)Ncells 431730 23.1 929718 49.7 607591 32.5Vcells 787605 6.1 8388608 64.0 1592403 12.2 data(iris) data head

    2、(data) Sepal.Length Sepal.Width Petal.Length Petal.Width Species1 5.1 3.5 1.4 0.2 setosa2 4.9 3.0 1.4 0.2 setosa3 4.7 3.2 1.3 0.2 setosa4 4.6 3.1 1.5 0.2 setosa5 5.0 3.6 1.4 0.2 setosa6 5.4 3.9 1.7 0.4 setosa#Kmean聚类分析 newiris newiris$Species (kc table(iris$Species, kc$cluster) 1 2 3 setosa 0 50 0 v

    3、ersicolor 48 0 2 virginica 14 0 36 plot(newirisc(Sepal.Length, Sepal.Width), col = kc$cluster) points(kc$centers,c(Sepal.Length, Sepal.Width), col = 1:3, pch = 8, cex=2)#K-Mediods 进行聚类分析 install.packages(cluster) library(cluster) iris.pam table(iris$Species,iris.pam$clustering) 1 2 3 setosa 50 0 0 v

    4、ersicolor 0 3 47 virginica 0 49 1 layout(matrix(c(1,2),1,2) plot(iris.pam) layout(matrix(1)#hc iris.hc plot( iris.hc, hang = -1) plclust( iris.hc, labels = FALSE, hang = -1) re iris.id sapply(unique(iris.id),+ function(g)iris$Speciesiris.id=g)1 1 setosa setosa setosa setosa setosa setosa setosa seto

    5、sa setosa setosa setosa12 setosa setosa setosa setosa setosa setosa setosa setosa setosa setosa setosa23 setosa setosa setosa setosa setosa setosa setosa setosa setosa setosa setosa34 setosa setosa setosa setosa setosa setosa setosa setosa setosa setosa setosa45 setosa setosa setosa setosa setosa se

    6、tosaLevels: setosa versicolor virginica2 1 versicolor versicolor versicolor versicolor versicolor versicolor versicolor 8 versicolor versicolor versicolor versicolor versicolor versicolor versicolor15 versicolor versicolor versicolor versicolor versicolor versicolor versicolor22 versicolor versicolo

    7、r virginica virginica virginica virginica virginica 29 virginica virginica virginica virginica virginica virginica virginica 36 virginica virginica virginica virginica virginica virginica virginica 43 virginica virginica virginica virginica virginica virginica virginica 50 virginica virginica virgin

    8、ica virginica virginica virginica virginica 57 virginica virginica virginica virginica virginica virginica virginica 64 virginica virginica virginica virginica virginica virginica virginica 71 virginica virginica Levels: setosa versicolor virginica3 1 versicolor versicolor versicolor versicolor vers

    9、icolor versicolor versicolor 8 versicolor versicolor versicolor versicolor versicolor versicolor versicolor15 versicolor versicolor versicolor versicolor versicolor versicolor versicolor22 versicolor versicolor versicolor versicolor versicolor versicolor virginica Levels: setosa versicolor virginica

    10、 plot(iris.hc) rect.hclust(iris.hc,k=4,border=light grey)#用浅灰色矩形框出4分类聚类结果 rect.hclust(iris.hc,k=3,border=dark grey)#用浅灰色矩形框出3分类聚类结果 rect.hclust(iris.hc,k=7,which=c(2,6),border=dark grey)# DBSCAN #基于密度的聚类 install.packages(fpc) library(fpc) ds1=dbscan(iris,1:4,eps=1,MinPts=5)#半径参数为1,密度阈值为5 ds1dbscan P

    11、ts=150 MinPts=5 eps=1 1 2border 0 1seed 50 99total 50 100 ds2=dbscan(iris,1:4,eps=4,MinPts=5) ds3=dbscan(iris,1:4,eps=4,MinPts=2) ds4=dbscan(iris,1:4,eps=8,MinPts=2) par(mfcol=c(2,2) plot(ds1,iris,1:4,main=1: MinPts=5 eps=1) plot(ds3,iris,1:4,main=3: MinPts=2 eps=4) plot(ds2,iris,1:4,main=2: MinPts=

    12、5 eps=4) plot(ds4,iris,1:4,main=4: MinPts=2 eps=8) d=dist(iris,1:4)#计算数据集的距离矩阵d max(d);min(d)#计算数据集样本的距离的最值1 7.0851961 0 install.packages(ggplot2) library(ggplot2) interval=cut_interval(d,30) table(interval)interval 0,0.236 (0.236,0.472 (0.472,0.709 (0.709,0.945 (0.945,1.18 (1.18,1.42 88 585 876 891

    13、 831 688 (1.42,1.65 (1.65,1.89 (1.89,2.13 (2.13,2.36 (2.36,2.6 (2.6,2.83 543 369 379 339 335 406 (2.83,3.07 (3.07,3.31 (3.31,3.54 (3.54,3.78 (3.78,4.01 (4.01,4.25 458 459 465 480 468 505 (4.25,4.49 (4.49,4.72 (4.72,4.96 (4.96,5.2 (5.2,5.43 (5.43,5.67 349 385 321 291 187 138 (5.67,5.9 (5.9,6.14 (6.14

    14、,6.38 (6.38,6.61 (6.61,6.85 (6.85,7.09 97 92 78 50 18 4 which.max(table(interval)(0.709,0.945 4 for(i in 3:5)+ for(j in 1:10)+ ds=dbscan(iris,1:4,eps=i,MinPts=j)+ print(ds)+ + dbscan Pts=150 MinPts=1 eps=3 1seed 150total 150dbscan Pts=150 MinPts=2 eps=3 1seed 150total 150dbscan Pts=150 MinPts=3 eps=

    15、3 1seed 150total 150dbscan Pts=150 MinPts=4 eps=3 1seed 150total 150dbscan Pts=150 MinPts=5 eps=3 1seed 150total 150dbscan Pts=150 MinPts=6 eps=3 1seed 150total 150dbscan Pts=150 MinPts=7 eps=3 1seed 150total 150dbscan Pts=150 MinPts=8 eps=3 1seed 150total 150dbscan Pts=150 MinPts=9 eps=3 1seed 150t

    16、otal 150dbscan Pts=150 MinPts=10 eps=3 1seed 150total 150dbscan Pts=150 MinPts=1 eps=4 1seed 150total 150dbscan Pts=150 MinPts=2 eps=4 1seed 150total 150dbscan Pts=150 MinPts=3 eps=4 1seed 150total 150dbscan Pts=150 MinPts=4 eps=4 1seed 150total 150dbscan Pts=150 MinPts=5 eps=4 1seed 150total 150dbs

    17、can Pts=150 MinPts=6 eps=4 1seed 150total 150dbscan Pts=150 MinPts=7 eps=4 1seed 150total 150dbscan Pts=150 MinPts=8 eps=4 1seed 150total 150dbscan Pts=150 MinPts=9 eps=4 1seed 150total 150dbscan Pts=150 MinPts=10 eps=4 1seed 150total 150dbscan Pts=150 MinPts=1 eps=5 1seed 150total 150dbscan Pts=150

    18、 MinPts=2 eps=5 1seed 150total 150dbscan Pts=150 MinPts=3 eps=5 1seed 150total 150dbscan Pts=150 MinPts=4 eps=5 1seed 150total 150dbscan Pts=150 MinPts=5 eps=5 1seed 150total 150dbscan Pts=150 MinPts=6 eps=5 1seed 150total 150dbscan Pts=150 MinPts=7 eps=5 1seed 150total 150dbscan Pts=150 MinPts=8 ep

    19、s=5 1seed 150total 150dbscan Pts=150 MinPts=9 eps=5 1seed 150total 150dbscan Pts=150 MinPts=10 eps=5 1seed 150total 150#30次dbscan的聚类结果 ds5=dbscan(iris,1:4,eps=3,MinPts=2) ds6=dbscan(iris,1:4,eps=4,MinPts=5) ds7=dbscan(iris,1:4,eps=5,MinPts=9) par(mfcol=c(1,3) plot(ds5,iris,1:4,main=1: MinPts=2 eps=3

    20、) plot(ds6,iris,1:4,main=3: MinPts=5 eps=4) plot(ds7,iris,1:4,main=2: MinPts=9 eps=5)# EM 期望最大化聚类 install.packages(mclust) library(mclust) fit_EM=Mclust(iris,1:4)fitting . |=| 100% summary(fit_EM)- Gaussian finite mixture model fitted by EM algorithm - Mclust VEV (ellipsoidal, equal shape) model wit

    21、h 2 components: log.likelihood n df BIC ICL -215.726 150 26 -561.7285 -561.7289Clustering table: 1 2 50 100 summary(fit_EM,parameters=TRUE)- Gaussian finite mixture model fitted by EM algorithm - Mclust VEV (ellipsoidal, equal shape) model with 2 components: log.likelihood n df BIC ICL -215.726 150

    22、26 -561.7285 -561.7289Clustering table: 1 2 50 100 Mixing probabilities: 1 2 0.3333319 0.6666681 Means: ,1 ,2Sepal.Length 5.0060022 6.261996Sepal.Width 3.4280049 2.871999Petal.Length 1.4620007 4.905992Petal.Width 0.2459998 1.675997Variances:,1 Sepal.Length Sepal.Width Petal.Length Petal.WidthSepal.L

    23、ength 0.15065114 0.13080115 0.02084463 0.01309107Sepal.Width 0.13080115 0.17604529 0.01603245 0.01221458Petal.Length 0.02084463 0.01603245 0.02808260 0.00601568Petal.Width 0.01309107 0.01221458 0.00601568 0.01042365,2 Sepal.Length Sepal.Width Petal.Length Petal.WidthSepal.Length 0.4000438 0.10865444

    24、 0.3994018 0.14368256Sepal.Width 0.1086544 0.10928077 0.1238904 0.07284384Petal.Length 0.3994018 0.12389040 0.6109024 0.25738990Petal.Width 0.1436826 0.07284384 0.2573899 0.16808182 plot(fit_EM)#对EM聚类结果作图Model-based clustering plots: 1: BIC2: classification3: uncertainty4: densitySelection: (下面显示选项)

    25、 #选1#选2#选3#选4Selection: 0 iris_BIC=mclustBIC(iris,1:4)fitting . |=| 100% iris_BICsum=summary(iris_BIC,data=iris,1:4) iris_BICsum #获取数1据集iris在各模型和类别数下的BIC值Best BIC values: VEV,2 VEV,3 VVV,2BIC -561.7285 -562.5522369 -574.01783BIC diff 0.0000 -0.8237748 -12.28937Classification table for model (VEV,2): 1 2 50 100 iris_BICBayesian Information Criterion (BIC): EII VII EEI VEI EVI VVI EEE1 -1804.0854 -1804.0854 -1522.1202 -1522.1202 -1522.1202 -1522.1202 -829.978


    注意事项

    本文(实验报告 聚类分析.docx)为本站会员主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2023 冰点文库 网站版权所有

    经营许可证编号:鄂ICP备19020893号-2


    收起
    展开