计算kappa系数

2022/1/8 6:33:31

本文主要是介绍计算kappa系数,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

转自:https://blog.csdn.net/u011630575/article/details/78594791

1.例子

from sklearn.metrics import cohen_kappa_score
y_true = [1,1,1]
y_pred = [2,2,2]
print(cohen_kappa_score(y_true, y_pred))

0.0

说明kappa系数的计算与label是有关系的,不像ARI和NMI计算与label无关:

NMI:

from sklearn.metrics.cluster import normalized_mutual_info_score
y_true = [1,1,1]
y_pred = [2,2,2]
print(normalized_mutual_info_score(y_true, y_pred))

1.0

ARI:

from sklearn.metrics.cluster import adjusted_rand_score
y_true = [1,1,1]
y_pred = [2,2,2]
print(adjusted_rand_score(y_true, y_pred))

1.0

 



这篇关于计算kappa系数的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程