转自: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