聚类分析(Clustering analysis) - ricket-sjtu/bi028 GitHub Wiki
1. 常用的聚类方法
1.0 数据预处理
标准化处理(Standaridization)
stats::scale(.., center=TRUE, scale=TRUE)
1.1 基于距离的聚类(Distance-based clustering)
关于距离的计算
距离的计算是基于距离的聚类分析的关键基础,常用的距离度量有欧氏距离、曼哈顿距离、明科夫斯基距离、编辑距离、相关距离、Jaccard距离等:
- R中的
stats::dist()
可计算大部分的连续变量的距离和二元变量(presence/absence)距离 - R中的
cluster::daisy()
可进行混合变量(包含连续和有序、分类变量)的距离计算 - R中的
veg::vegdist()
可计算组成数据(compositional data)的距离,例如Bray-Curtis
、
层次聚类(Hierarchical clustering)
- 基于分裂的层次聚类(Divisive hierarchical clustering):
cluster::diana()
- 基于凝聚的层次聚类(Agglomerative hierarchical clustering):
cluster::agnes()
- 二元变量数据的分裂式聚类(Divisive hierarchical clustering of binary dataset):
cluster::mona()
划分的方法(Partitioning-based clustering)
- K-均值聚类(K-Means clustering):
stats::kmeans()
- 自组织映射(Self-organized mapping, SOM):
- PAM(Partitioning Around Medoids):
cluster::pam()
- Clustering of large data set(clara):
cluster::clara()
- 模糊聚类(fuzzy clusteirng):
cluster::fanny()
1.2 基于模型的聚类(Model-based clustering)
mclust::Mclust()
2. 聚类结果的评价
2.1 内部评价标准
- Silhouette指数(Silhouette width)
- Dunn指数(Dunn's index)
- FOM测量
2.2 外部评价标准
fpc::cluster.stats()
可以计算- cluster size
- cluster diameters
- average distances within and between clusters
- cluster separation
- biggest within-cluster gap
- average Silhouette widths
- Dunn's index
- Corrected Rand index
2.3 R评判函数
- Silhouette指数:
stats::silhouette()
3. 可视化分析(Visualization)
cluster::ellipsoidhull
:为聚类结果绘制椭圆显示- ``