美文网首页ggplot集锦
轮廓系数--【Silhouette Coefficient】

轮廓系数--【Silhouette Coefficient】

作者: 倪桦 | 来源:发表于2023-04-17 11:04 被阅读0次

轮廓系数(Silhouette Coefficient),是聚类效果好坏的一种评价方式。最早由 Peter J. Rousseeuw 在 1986 提出。它结合内聚度和分离度两种因素。可以用来在相同原始数据的基础上用来评价不同算法、或者算法不同运行方式对聚类结果所产生的影响。

silhouette = sil = \frac {b_i - a_i}{max(a_i,b_i)} , i \in sample\{1,2,..N\}

  • a_i :样本 i 到簇内其它样本的平均距离,反映了簇内不相似度。
  • b_i :样本 i 到最近外簇的距离,b_i = \min(b_{i1},b_{i2},..b_{ij}),j\in cluster\{1,2,..j\},反映了簇间不相似度。

轮廓系数的判断

silhouette 接近 1,说明样本S_i 聚类合理;
silhouette 接近 -1,说明样本S_i 更应该分类到另外的簇;
silhouette 近似 0,说明样本S_i 在两个簇的边界上。

R code

#### Build hclust Tree
hc_dist <- amap::Dist(counts)
hc_tree <- amap::hcluster(counts, method = "euclidean",link = "ward")

#### dynamic—clustering ; deepSplit 控制聚类精度
memb <- dynamicTreeCut::cutreeDynamic(hc_tree,
                                      distM = as.matrix(hc_dist),
                                      deepSplit = .5, minClusterSize = 1)

### 计算当前分簇的轮廓系数,合并不理想的簇到最近的簇
memb <- cluster::silhouette(memb, dist = hc_dist) %>% data.frame() %>% 
    mutate(across(1:2,.fns = as.character)) %>% 
    group_by(cluster) %>% mutate(avg_sil = mean(sil_width)) %>% 
    mutate(cluster_adj = ifelse(avg_sil < 0 ,
                                yes = as.numeric(names(which.max(table(neighbor)))),
                                no = as.numeric(cluster))) %>% 
    ungroup() %>% pull(cluster_adj)
if(F) plot(cluster::silhouette(memb, dist = hc_dist))

相关文章

  • 聚类评估:轮廓系数(Silhouette Coefficient

    计算样本i到同簇其他样本的平均距离ai,ai越小,说明样本i越应该被聚类到该簇。将ai 成为样本i的簇内不相似度。...

  • GraphPad Prism 7进行pearson相关性分析

    pearson相关系数(Pearson correlation coefficient)也叫pearson积差相关...

  • Pearson Correlation Coefficient

    Pearson Correlation Coefficient 皮尔逊相关系数 皮尔森相关系数是用来反映两个变量线...

  • 裁缝用词

    ruffle 荷叶边;haute couture 高级定制服;silhouette 轮廓剪裁;sheath 贴身版...

  • 显著性分析

    1、Coefficient 系数 回归分析的系数代表了每个自变量对因变量的贡献度,系数的绝对值越大,表示该变量在模...

  • 基尼系数

    下面是基尼系数的百度定义 基尼系数(英文:Gini index、Gini Coefficient)是指国际上通用的...

  • Pearson Correlation Coefficient

    简介 皮尔逊相关系数(Pearson Correlation Coefficient, pcc)可以度量两个随机变...

  • 组内相关系数的意义及R语言实现

    组内相关系数(intra-class correlation coefficient, ICC)的用途、类型以及计...

  • 巧用β系数选择基金

    β系数也称为贝塔系数(Beta coefficient)通常也称之为聪明的贝塔,是一种风险指数,用来衡量个别股票或...

  • 相关系数

    什么是相关系数 相关系数,Correlation coefficient是描述两个变量之间的相关关系的密切程度,一...

网友评论

    本文标题:轮廓系数--【Silhouette Coefficient】

    本文链接:https://www.haomeiwen.com/subject/idxcjdtx.html