python中的分群质量
主要参考来自官方文档:Clustering
部分内容来源于:机器学习评价指标大汇总
个人比较偏好的三个指标有:Calinski-Harabaz Index(未知真实index的模型评估)、Homogeneity, completeness and V-measure(聚类数量情况)、轮廓系数
1.1 Adjusted Rand index 调整兰德系数
>>>from sklearn import metrics
>>>labels_true = [0, 0, 0, 1, 1, 1]
>>>labels_pred = [0, 0, 1, 1, 2, 2]
>>>metrics.adjusted_rand_score(labels_true, labels_pred)
0.24
.
1.2 Mutual Information based scores 互信息
Two different normalized versions of this measure are available, Normalized Mutual Information(NMI) and Adjusted Mutual Information(AMI). NMI is often used in the literature while AMI was proposed more recently and is normalized against chance:
>>>from sklearn import metrics