社团划分结果评估指标:Q、ARI、NMI

Face the past with the least regrets, face the present with the least waste and face the future with the most dreams.

不悔恨过去;不荒废现在;充满梦想,面对未来。

社团划分结果评估指标:Q、ARI、NMI

一、模块度Q(Modularity)

模块度也称模块化度量值,是目前常用的一种衡量网络社区结构强度的方法,最早由Mark NewMan提出了。模块度的定义为:

Q=12ij[Aijkikj2m]δ(Ci,Cj)

模块度值的大小主要取决于网络中结点的社区分配C,即网络的社区划分情况,可以用来定量的衡量网络社区划分质量,其值越接近1,表示网络划分出的社区结构的强度越强,也就是划分质量越好。因此可以通过最大化模块度Q来获得最优的网络社区划分。

Python:可以直接使用Community.modularity()包计算模块度。

二、兰德指数ARI(Adjusted Rand Index)

若已知样本的真实类别标签 labelstrue ,和聚类算法得到的标签 labelspred ,ARI是计算两种标签分布相似性的函数,该函数对标签的定义形式没有要求。ARI定义如下:

如果C是真实类别,K是聚类结果,我们定义a和b分别是:

a: 在C和K中都是同一类别的样本对数

b: 在C和K中都是不同类别的样本对数

Raw Rand Index公式如下:

RI=a+bCnsamples2

RI=a+bCnsamples2 是样本所有的可能组合对.

RI不能保证在类别标签是随机分配的情况下,其值接近0(极端情况是类别数和样本数相等).为了解决这个问题,ARI被提出,它具有更高的区分度.

ARI=RIE[RI]max(RI)E[RI]

Python:使用sklearn.metrics.adjusted_rand_score(labels_true, labels_pred)计算。

三、标准化互信息NMI(Normalized Mutual Information)

假设对于N个样本点的两种标签划分为U 和 V. 熵为划分集的不准确性,定义如下:

H(U)=i=1|U|P(i)log(P(i))

其中 P(i)=|Ui|/N 表示任取一个样本划分为 Ui 的概率. 对于V同时成立:
H(V)=j=1|V|P(j)log(P(j))

其中 P(j)=|Vj|/N . U和V之间的互信息(MI) 可以通过下式进行计算:
MI(U,V)=i=1|U|j=1|V|P(i,j)log(P(i,j)P(i)P(j))

其中 P(i,j)=|UiVj|/N 表示两个样本点划分相同的类 UiVj 的概率.
也可以通过集合的势来表示:
MI(U,V)=i=1|U|j=1|V||UiVj|Nlog(N|UiVj||Ui||Vj|)

规则化互信息定义如下:
NMI(U,V)=MI(U,V)H(U)H(V)

This value of the mutual information and also the normalized variant is not adjusted for chance and will tend to increase as the number of different labels (clusters) increases, regardless of the actual amount of “mutual information” between the label assignments.
The expected value for the mutual information can be calculated using the following equation, from Vinh, Epps, and Bailey, (2009). In this equation, ai=|Ui| (the number of elements in Ui ) and bj=|Vj| (the number of elements in Vj ).
E[MI(U,V)]=i=1|U|j=1|V|nij=(ai+bjN)+min(ai,bj)nijNlog(N.nijaibj)ai!bj!(Nai)!(Nbj)!N!nij!(ainij)!(bjnij)!(Naibj+nij)!

Using the expected value, the adjusted mutual information can then be calculated using a similar form to that of the adjusted Rand index:
AMI=MIE[MI]max(H(U),H(V))E[MI]

Python: 使用sklearn.metrics.normalized_mutual_info_score(labels_true, labels_pred)计算。

  • 6
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值