网易首页 > 网易号 > 正文 申请入驻

聚类算法(下):10个聚类算法的评价指标

0
分享至

上篇文章我们已经介绍了一些常见的聚类算法,下面我们将要介绍评估聚类算法的指标


1、Rand Index

Rand Index(兰德指数)是一种衡量聚类算法性能的指标。它衡量的是聚类算法将数据点分配到聚类中的准确程度。兰德指数的范围从0到1,1的值表示两个聚类完全相同,接近0的值表示两个聚类有很大的不同。需要注意的是,Rand Index只能用于评估将样本点分成两个簇的聚类算法。对于将样本点分成多个簇的聚类算法,需要使用其他的指标来评估其性能。

它的公式如下:

这里的:

a→在真实标签中处于同一簇中的样本对数,在预测聚类中处于同一簇中的样本对数。

b→真实聚类和预测聚类中处于不同聚类的样本对的数目。

要验证条件a和b,我们使用以下代码:

if y_true[i] == y_true[j] and y_pred[i] == y_pred[j]:
a += 1
elif y_true[i] != y_true[j] and y_pred[i] != y_pred[j]:
b += 1
#Where j= i+1

为了找到大型数组的可能组合的数量,我们可以使用math库中的“comb”函数。这个函数有两个参数n和k:

#comb function:
from math import comb
#math.comb(n,k):
print(comb(len(df['cluster_id']),2))

以下就是python的代码实现:

def rand_index_score(y_true, y_pred):
# Initialize variables
a, b = 0,0
# Compute variables
for i in range(len(y_true)):
for j in range(i+1, len(y_true)):
if y_true[i] == y_true[j] and y_pred[i] == y_pred[j]:
a += 1
elif y_true[i] != y_true[j] and y_pred[i] != y_pred[j]:
b += 1
#combinations
combinations = comb(len(y_true),2)
# Compute Rand Index
rand_index = (a + b) / combinations
print(a)
print(b)
return rand_index
#Call the function and print result:
print(rand_index_score(df['cluster_id'], km_labels))

Sklearn已经包含了他的实现:rand_score函数,所以我们可以直接使用它

from sklearn import metrics
print('Rand Index for K-Means is:', metrics.rand_score(df['cluster_id'], km_labels))
print('Rand Index for Affinity Propagation is:', metrics.rand_score(df['cluster_id'], af_labels))
print('Rand Index for Aglomerative Clustering is:', metrics.rand_score(df['cluster_id'], AC_labels))
print('Rand Index for Mean Shift is:', metrics.rand_score(df['cluster_id'], MS_labels))
print('Rand Index for Bisecting KM is:', metrics.rand_score(df['cluster_id'], BKM_labels))
print('Rand Index for DBSCAN is:', metrics.rand_score(df['cluster_id'], DBSCAN_labels))
print('Rand Index for OPTICS is:', metrics.rand_score(df['cluster_id'], OPTICS_labels))
print('Rand Index for BIRCH is:', metrics.rand_score(df['cluster_id'], BIRCH_labels))

构建可视化图形

#Build a dataframe:
data = {'Model':["KM", "AP", "AC", "MS", "BKM", "DBSCAN", "OPTICS", "BIRCH"],'Rand_Index':[0.99, 0.93,1, 0.99, 0.94, 0.91, 0.95,1]}
Rand_Index = pd.DataFrame(data)
# Make the plot
y_pos = np.arange(len(Rand_Index['Model']))
plt.stem(Rand_Index['Rand_Index'])
plt.xticks(y_pos, Rand_Index['Model'])
plt.show()

2、Adjusted Rand Score

Adjusted Rand Score(调整兰德指数)是一种用于衡量聚类算法性能的指标,它是Rand Index的一种调整形式,可以用于评估将样本点分为多个簇的聚类算法。它考虑了机会的概率,取值范围为,其中值越接近1表示聚类结果越准确,值越接近0表示聚类结果与随机结果相当,值越接近-1表示聚类结果与真实类别完全相反。

print('Adjusted Rand Score for K-Means is:', metrics.adjusted_rand_score(df['cluster_id'], km_labels))
print('Adjusted Rand Score for Affinity Propagation is:', metrics.adjusted_rand_score(df['cluster_id'], af_labels))
print('Adjusted Rand Score for Aglomerative Clustering is:', metrics.adjusted_rand_score(df['cluster_id'], AC_labels))
print('Adjusted Rand Score for Mean Shift is:', metrics.adjusted_rand_score(df['cluster_id'], MS_labels))
print('Adjusted Rand Score for Bisecting KM is:', metrics.adjusted_rand_score(df['cluster_id'], BKM_labels))
print('Adjusted Rand Score for DBSCAN is:', metrics.adjusted_rand_score(df['cluster_id'], DBSCAN_labels))
print('Adjusted Rand Score for OPTICS is:', metrics.adjusted_rand_score(df['cluster_id'], OPTICS_labels))
print('Adjusted Rand Score for BIRCH is:', metrics.adjusted_rand_score(df['cluster_id'], BIRCH_labels))
data = {'Model':["KM", "AP", "AC", "MS", "BKM", "DBSCAN", "OPTICS", "BIRCH"],'Adj_Rand_Score':[0.97, 0.81,0.98, 0.97, 0.82, 0.74, 0.48, 0.92]}
Adj_Rand_Score = pd.DataFrame(data)
# Make the plot
y_pos = np.arange(len(Adj_Rand_Score['Model']))
plt.bar(y_pos,Adj_Rand_Score['Adj_Rand_Score'])
plt.xticks(y_pos, Adj_Rand_Score['Model'])
plt.show()

3、Mutual Information-based Score

基于互信息的分数(Mutual Information-based Score)是一种用于衡量聚类算法性能的指标,它衡量的是聚类结果与真实标签之间的相似性。基于互信息的分数可以用于评估将样本点分为多个簇的聚类算法。

基于互信息的分数的取值范围为,其中值越接近1表示聚类结果越准确,值越接近0表示聚类结果与随机结果相当,值越小表示聚类结果与真实类别之间的差异越大。基于互信息的分数是一种相对指标,它的取值受到真实类别数量的影响。当真实类别数量很大时,基于互信息的分数可能会受到偏差。

用Scikit-Learn可以计算MI:

print('Mutual Information Based Scores for K-Means is:', metrics.mutual_info_score(df['cluster_id'], km_labels))
print('Mutual Information Based Scores for Affinity Propagation is:', metrics.mutual_info_score(df['cluster_id'], af_labels))
print('Mutual Information Based Scores for Aglomerative Clustering is:', metrics.mutual_info_score(df['cluster_id'], AC_labels))
print('Mutual Information Based Scores for Mean Shift is:', metrics.mutual_info_score(df['cluster_id'], MS_labels))
print('Mutual Information Based Scores for Bisecting KM is:', metrics.mutual_info_score(df['cluster_id'], BKM_labels))
print('Mutual Information Based Scores for DBSCAN is:', metrics.mutual_info_score(df['cluster_id'], DBSCAN_labels))
print('Mutual Information Based Scores for OPTICS is:', metrics.mutual_info_score(df['cluster_id'], OPTICS_labels))
print('Mutual Information Based Scores for BIRCH is:', metrics.mutual_info_score(df['cluster_id'], BIRCH_labels))

3、Normalized Mutual Information Scor

Normalized Mutual Information Score(标准化互信息分数)是基于互信息的分数的一种标准化形式,可以用于评估将样本点分为多个簇的聚类算法。它知识将互信息分数进行了标准化,在0(表示没有互信息)和1(表示完全相关)之间进行缩放。为了标准化上一步中得到的结果,我们只需要做一点额外的工作:

h_true = -np.sum(px * np.log(px))
h_pred = -np.sum(py * np.log(py))
nmi = mi / ((h_true + h_pred) / 2)

与基于互信息的分数相比,标准化互信息分数更加稳健,不受真实类别数量的影响。

print('Mutual Information Based Scores for K-Means is:', metrics.normalized_mutual_info_score(df['cluster_id'], km_labels))
print('Mutual Information Based Scores for Affinity Propagation is:', metrics.normalized_mutual_info_score(df['cluster_id'], af_labels))
print('Mutual Information Based Scores for Aglomerative Clustering is:', metrics.normalized_mutual_info_score(df['cluster_id'], AC_labels))
print('Mutual Information Based Scores for Mean Shift is:', metrics.normalized_mutual_info_score(df['cluster_id'], MS_labels))
print('Mutual Information Based Scores for Bisecting KM is:', metrics.normalized_mutual_info_score(df['cluster_id'], BKM_labels))
print('Mutual Information Based Scores for DBSCAN is:', metrics.normalized_mutual_info_score(df['cluster_id'], DBSCAN_labels))
print('Mutual Information Based Scores for OPTICS is:', metrics.normalized_mutual_info_score(df['cluster_id'], OPTICS_labels))
print('Mutual Information Based Scores for BIRCH is:', metrics.normalized_mutual_info_score(df['cluster_id'], BIRCH_labels))

4、Adjusted Mutual Information Score

Adjusted Mutual Information Score(调整互信息分数)是一种用于衡量聚类算法性能的指标,它是基于互信息的分数的一种调整形式,AMI不受标签数值的影响,即使标签重新排序,也会产生相同的分数。公式如下所示,其中E代表预期:

AMI(U, V) = [MI(U, V) -E(MI(U, V))] / [avg(H(U), H(V)) -E(MI(U, V))]

print('Mutual Information Based Scores for K-Means is:', metrics.adjusted_mutual_info_score(df['cluster_id'], km_labels))
print('Mutual Information Based Scores for Affinity Propagation is:', metrics.adjusted_mutual_info_score(df['cluster_id'], af_labels))
print('Mutual Information Based Scores for Aglomerative Clustering is:', metrics.adjusted_mutual_info_score(df['cluster_id'], AC_labels))
print('Mutual Information Based Scores for Mean Shift is:', metrics.adjusted_mutual_info_score(df['cluster_id'], MS_labels))
print('Mutual Information Based Scores for Bisecting KM is:', metrics.adjusted_mutual_info_score(df['cluster_id'], BKM_labels))
print('Mutual Information Based Scores for DBSCAN is:', metrics.adjusted_mutual_info_score(df['cluster_id'], DBSCAN_labels))
print('Mutual Information Based Scores for OPTICS is:', metrics.adjusted_mutual_info_score(df['cluster_id'], OPTICS_labels))
print('Mutual Information Based Scores for BIRCH is:', metrics.adjusted_mutual_info_score(df['cluster_id'], BIRCH_labels))

与基于互信息的分数和标准化互信息分数相比,调整互信息分数更加稳健,可以通过随机置换进行期望值的估计,从而避免了真实类别数量的影响。

5、Homogeneity and Completeness Score

Homogeneity Score和Completeness Score是两个用于评估聚类结果的指标,它们可以用于衡量聚类算法对数据的划分是否“同质”(即簇内只包含同一类别的样本点)以及是否“完整”(即同一类别的样本点是否被划分到同一个簇中)。

同质性和完整性是给定公式的两个相关度量:

为了获得同质性和完整性,我们需要找到真实标签的熵(H)和预测标签的H,以及给定预测标签的真实标签的条件联合熵(CJH),以及给定真实标签的预测标签的CJH。

def entropy(arr):
#Find unique values and their counts:
unique, counts = np.unique(arr, return_counts=True)
#Get the probability for each cluster (unique value):
p = counts / len(arr)
#Apply entropy formula:
entropy = -np.sum(p * np.log2(p))
return entropy
entropy_y_true = entropy(y_true)
entropy_km_labels = entropy(km_labels)
print('Entropy for y_true: ', entropy_y_true)
print('Entropy for km_labels: ', entropy_km_labels)

然后计算联合熵:

import numpy as np
from collections import Counter
import math
def conditional_entropy(X, Y):
#Build a 2D-numpy array with true clusters and predicted clusters:
XY = np.column_stack((X, Y))
#Count the number of observations in X and Y with the same values:
xy_counts = Counter(map(tuple, XY))
#Get the joint probability:
joint_prob = np.array(list(xy_counts.values())) / len(XY)
#Get conditional probability:
y_counts = Counter(Y)
conditional_prob = np.zeros_like(joint_prob)
for i, (x, y) in enumerate(xy_counts.keys()):
conditional_prob[i] = xy_counts[(x, y)] / y_counts[y]
#Get conditional entropy:
conditional_entropy = -np.sum(joint_prob * np.log2(conditional_prob + 1e-10))
return conditional_entropy
joint_entropy_y_true = conditional_entropy(y_true, km_labels)
print('Joint entropy for y_true given km_labels is: ', joint_entropy_y_true)
joint_entropy_km_labels = conditional_entropy(km_labels, y_true)
print('Joint entropy for km_labels given y_true is: ', joint_entropy_km_labels)

现在可以计算同质性和完整性值:

homogeneity = 1 - (joint_entropy_y_true / entropy_y_true)
print('homogeneity: ', homogeneity)
completeness = 1 - (joint_entropy_km_labels / entropy_km_labels)
print('Completeness: ', completeness)

当然,sklearn也提供了相关的函数

#Homogeneity:
print('Homogeneity for K-Means is:', metrics.homogeneity_score(df['cluster_id'], km_labels))
print('Homogeneity for Affinity Propagation is:', metrics.homogeneity_score(df['cluster_id'], af_labels))
print('Homogeneity for Aglomerative Clustering is:', metrics.homogeneity_score(df['cluster_id'], AC_labels))
print('Homogeneity for Mean Shift is:', metrics.homogeneity_score(df['cluster_id'], MS_labels))
print('Homogeneity for Bisecting KM is:', metrics.homogeneity_score(df['cluster_id'], BKM_labels))
print('Homogeneity for DBSCAN is:', metrics.homogeneity_score(df['cluster_id'], DBSCAN_labels))
print('Homogeneity for OPTICS is:', metrics.homogeneity_score(df['cluster_id'], OPTICS_labels))
print('Homogeneity for BIRCH is:', metrics.homogeneity_score(df['cluster_id'], BIRCH_labels))
#Completeness:
print('Completeness for K-Means is:', metrics.completeness_score(df['cluster_id'], km_labels))
print('Completeness for Affinity Propagation is:', metrics.completeness_score(df['cluster_id'], af_labels))
print('Completeness for Aglomerative Clustering is:', metrics.completeness_score(df['cluster_id'], AC_labels))
print('Completeness for Mean Shift is:', metrics.completeness_score(df['cluster_id'], MS_labels))
print('Completeness for Bisecting KM is:', metrics.completeness_score(df['cluster_id'], BKM_labels))
print('Completeness for DBSCAN is:', metrics.completeness_score(df['cluster_id'], DBSCAN_labels))
print('Completeness for OPTICS is:', metrics.completeness_score(df['cluster_id'], OPTICS_labels))
print('Completeness for BIRCH is:', metrics.completeness_score(df['cluster_id'], BIRCH_labels))

该指标的取值范围也为,值越大表示聚类结果越好。需要注意的是,该指标对簇的数量较为敏感,因此在使用时需要结合实际问题进行调参。

6、V-Measure

V-Measure是一种综合考虑同质性和完整性的评估指标,可以用于衡量聚类算法对数据的划分质量。

beta = 1
v_measure = ((1+beta)*homogeneity*completeness) / (beta*homogeneity+completeness)
print('V-Measure is: ', v_measure)
#Or simply:
metrics.v_measure_score(y_true, km_labels)

V-Measure的取值范围为,值越大表示聚类结果越好。

7、Fowlkes-Mallows Score

fowlkes - malos分数是这个是最容易理解的,它主要基于数据的真实标签和聚类结果的交集、联合集以及簇内和簇间点对数的比值来计算。由以下公式得到:

python的实现代码如下:

def fowlkes_mallows_score(labels_true, labels_pred):
n = len(labels_true)
tp, fp, tn, fn = 0, 0, 0, 0
for i in range(n):
for j in range(i + 1, n):
if labels_true[i] == labels_true[j] and labels_pred[i] == labels_pred[j]:
tp += 1
elif labels_true[i] != labels_true[j] and labels_pred[i] == labels_pred[j]:
fp += 1
elif labels_true[i] == labels_true[j] and labels_pred[i] != labels_pred[j]:
fn += 1
else:
tn += 1
FM_score = tp / np.sqrt((tp + fp) * (tp + fn))
return FM_score
FM_score = fowlkes_mallows_score(y_true, km_labels)
print('Fowlkes Mallows Score is: ', FM_score)

sklearn计算:

print('Fowlkes Mallows Score for K-Means is:', metrics.fowlkes_mallows_score(df['cluster_id'], km_labels))
print('Fowlkes Mallows Score for Affinity Propagation is:', metrics.fowlkes_mallows_score(df['cluster_id'], af_labels))
print('Fowlkes Mallows Score for Aglomerative Clustering is:', metrics.fowlkes_mallows_score(df['cluster_id'], AC_labels))
print('Fowlkes Mallows Score for Mean Shift is:', metrics.fowlkes_mallows_score(df['cluster_id'], MS_labels))
print('Fowlkes Mallows Score for Bisecting KM is:', metrics.fowlkes_mallows_score(df['cluster_id'], BKM_labels))
print('Fowlkes Mallows Score for DBSCAN is:', metrics.fowlkes_mallows_score(df['cluster_id'], DBSCAN_labels))
print('Fowlkes Mallows Score for OPTICS is:', metrics.fowlkes_mallows_score(df['cluster_id'], OPTICS_labels))
print('Fowlkes Mallows Score for BIRCH is:', metrics.fowlkes_mallows_score(df['cluster_id'], BIRCH_labels))

以上这些指标都是当我们知道真正的类的标签是可以使用(还记得上一篇中我们的cluster_id吗),这些评估聚类方法的指标是可解释的。下面我们将介绍一些不知道真正的类时评估聚类指标的指标。

8、Silhouette Score

轮廓分数使用同一聚类中的点之间的距离,以及下一个临近聚类中的点与所有其他点之间的距离来评估模型的表现。它主要基于样本点与其所属簇内和最近邻簇之间的距离、相似性和紧密度等因素来计算。数值越高,模型性能越好。一般公式为:

这里的:

a→样本与同类中所有其他点之间的平均距离。

b→样本与下一个最近聚类中所有其他点之间的平均距离。

要在Python中实现Silhouette Score公式,我们可以使用以下代码:

n_samples = len(X)
cluster_labels = np.unique(km_labels)
n_clusters = len(cluster_labels)
silhouette_vals = np.zeros(n_samples)
for i in range(n_samples):
a_i = np.mean([np.linalg.norm(X[i] - X[j]) for j in range(n_samples) if km_labels[j] == km_labels[i] and j != i])
b_i = np.min([np.mean([np.linalg.norm(X[i] - X[j]) for j in range(n_samples) if km_labels[j] == k]) for k in cluster_labels if k != km_labels[i]])
silhouette_vals[i] = (b_i - a_i) / max(a_i, b_i)
silhouette_score = np.mean(silhouette_vals)
print(silhouette_score)

sklearn的实现:

print('Silhouette Coefficient for K-Means is:', metrics.silhouette_score(X, km_labels, metric='euclidean'))
print('Silhouette Coefficient for Affinity Propagation is:', metrics.silhouette_score(X, af_labels, metric='euclidean'))
print('Silhouette Coefficient for Aglomerative Clustering is:', metrics.silhouette_score(X, AC_labels, metric='euclidean'))
print('Silhouette Coefficient for Mean Shift is:', metrics.silhouette_score(X, MS_labels, metric='euclidean'))
print('Silhouette Coefficient for Bisecting KM is:', metrics.silhouette_score(X, BKM_labels, metric='euclidean'))
print('Silhouette Coefficient for DBSCAN is:', metrics.silhouette_score(X, DBSCAN_labels, metric='euclidean'))
print('Silhouette Coefficient for OPTICS is:', metrics.silhouette_score(X, OPTICS_labels, metric='euclidean'))
print('Silhouette Coefficient for BIRCH is:', metrics.silhouette_score(X, BIRCH_labels, metric='euclidean'))

Silhouette Score还可以用于确定聚类的最优簇数。通过计算不同簇数下的Silhouette Score,可以选择使得Silhouette Score最大的簇数作为最终的聚类结果。

9、Calinski-Harabasz Index

Calinski-Harabasz Index(也称Variance Ratio Criterion)是一种用于衡量聚类算法性能的指标,它主要基于簇内和簇间方差之间的比值来计算。

和分别表示簇间协方差矩阵和簇内协方差矩阵的迹。Calinski-Harabasz Index的取值范围为,值越大表示聚类结果越好。

Calinski-Harabasz Index也可以用于确定聚类的最优簇数。通过计算不同簇数下的Calinski-Harabasz Index,可以选择使得Calinski-Harabasz Index最大的簇数作为最终的聚类结果。以下是python的代码实现:

def calinski_harabasz_score(X, labels):
n_samples, _ = X.shape
n_labels = len(np.unique(labels))
if n_labels == 1:
return np.nan
mean = np.mean(X, axis=0)
extra_disp, intra_disp = 0., 0.
for k in range(n_labels):
cluster_k = X[labels == k]
mean_k = np.mean(cluster_k, axis=0)
extra_disp += cluster_k.shape[0] * np.sum((mean_k - mean) ** 2)
intra_disp += np.sum((cluster_k - mean_k) ** 2)
chs = (extra_disp / (n_labels - 1)) / (intra_disp / (n_samples - n_labels))
return chs
CHS = calinski_harabasz_score(X, km_labels)
print(CHS)

sklearn的实现我们可以直接使用

print('Calinski-Harabasz Index for K-Means is:', metrics.calinski_harabasz_score(X, km_labels))
print('Calinski-Harabasz Index for Affinity Propagation is:', metrics.calinski_harabasz_score(X, af_labels))
print('Calinski-Harabasz Index for Aglomerative Clustering is:', metrics.calinski_harabasz_score(X, AC_labels))
print('Calinski-Harabasz Index for Mean Shift is:', metrics.calinski_harabasz_score(X, MS_labels))
print('Calinski-Harabasz Index for Bisecting KM is:', metrics.calinski_harabasz_score(X, BKM_labels))
print('Calinski-Harabasz Index for DBSCAN is:', metrics.calinski_harabasz_score(X, DBSCAN_labels))
print('Calinski-Harabasz Index for OPTICS is:', metrics.calinski_harabasz_score(X, OPTICS_labels))
print('Calinski-Harabasz Index for BIRCH is:', metrics.calinski_harabasz_score(X, BIRCH_labels))

10、Davies-Bouldin Index

Davies-Bouldin Index主要基于簇内的紧密度和簇间的分离度来计算。Davies-Bouldin Index的取值范围为,值越小表示聚类结果越好。

python代码实现:

def euclidean_distance(x, y):
return np.sqrt(np.sum((x - y)**2))
def davies_bouldin(X, labels):
n_clusters = len(np.bincount(labels))
cluster_k = [X[labels == k] for k in range(n_clusters)]
centroids = [np.mean(k, axis=0) for k in cluster_k]
db_indices = []
for i, k_i in enumerate(cluster_k):
s_i = np.mean([np.linalg.norm(x - centroids[i]) for x in k_i])
R = []
for j, k_j in enumerate(cluster_k):
if j != i:
s_j = np.mean([np.linalg.norm(x - centroids[j]) for x in k_j])
dist = np.linalg.norm(centroids[i] - centroids[j])
R.append((s_i + s_j) / dist)
db_indices.append(np.max(R))
return np.mean(db_indices)
DB_Index = davies_bouldin(X, km_labels)
print(DB_Index)

sklearn:

print('Davies-Bouldin Index for K-Means is:', metrics.davies_bouldin_score(X, km_labels))
print('Davies-Bouldin Index for Affinity Propagation is:', metrics.davies_bouldin_score(X, af_labels))
print('Davies-Bouldin Index for Aglomerative Clustering is:', metrics.davies_bouldin_score(X, AC_labels))
print('Davies-Bouldin Index for Mean Shift is:', metrics.davies_bouldin_score(X, MS_labels))
print('Davies-Bouldin Index for Bisecting KM is:', metrics.davies_bouldin_score(X, BKM_labels))
print('Davies-Bouldin Index for DBSCAN is:', metrics.davies_bouldin_score(X, DBSCAN_labels))
print('Davies-Bouldin Index for OPTICS is:', metrics.davies_bouldin_score(X, OPTICS_labels))
print('Davies-Bouldin Index for BIRCH is:', metrics.davies_bouldin_score(X, BIRCH_labels))

总结

在聚类算法中,评估聚类结果的好坏是非常重要的。常见的聚类评估指标包括:

  • Rand Index:用于衡量聚类结果和真实标签之间的相似度。
  • Adjusted Rand Score:Rand Index的调整版本,可以对随机结果进行惩罚。
  • Mutual Information Score(基于互信息的分数):衡量聚类结果和真实标签之间的相似度。
  • Normalized Mutual Information Score:Mutual Information Score的归一化版本。
  • Adjusted Mutual Information Score:Normalized Mutual Information Score的调整版本。
  • Homogeneity and Completeness Score:分别衡量聚类结果的同质性和完整性。
  • V-Measure:基于Homogeneity和Completeness Score计算的综合评估指标。
  • Fowlkes-Mallows Score:用于衡量聚类结果和真实标签之间的相似度。
  • Silhouette Score:用于衡量聚类结果中每个样本点与自身簇和其他簇之间的相似度。
  • Calinski-Harabasz Index:基于簇内和簇间方差之间的比值来计算聚类性能。
  • Davies-Bouldin Index:基于簇内的紧密度和簇间的分离度来计算聚类性能。

需要根据具体的问题选择适合的评估指标,并结合实际情况进行调参。

https://avoid.overfit.cn/post/abf0739d6877426ca63870cac6202e2c

特别声明:以上内容(如有图片或视频亦包括在内)为自媒体平台“网易号”用户上传并发布,本平台仅提供信息存储服务。

Notice: The content above (including the pictures and videos if any) is uploaded and posted by a user of NetEase Hao, which is a social media platform and only provides information storage services.

相关推荐
热点推荐
路虎1分钟别8次事件最新进展,路虎司机已刑拘,当事人遭电话轰炸

路虎1分钟别8次事件最新进展,路虎司机已刑拘,当事人遭电话轰炸

奇思妙想草叶君
2026-03-19 22:39:18
12天票房破12亿,力压《镖人》轻松夺冠,吴京的全球冠军梦要碎了

12天票房破12亿,力压《镖人》轻松夺冠,吴京的全球冠军梦要碎了

影视高原说
2026-03-20 06:57:54
特朗普:正考虑逐步降级对伊行动 霍尔木兹海峡须由“使用国”守卫

特朗普:正考虑逐步降级对伊行动 霍尔木兹海峡须由“使用国”守卫

新华社
2026-03-21 07:49:02
伊朗媒体:沙特发生多起剧烈爆炸

伊朗媒体:沙特发生多起剧烈爆炸

澎湃新闻
2026-03-21 01:46:05
4000吨稀土被转运美国?大陆停供台湾稀土!台学者:不如直接统一

4000吨稀土被转运美国?大陆停供台湾稀土!台学者:不如直接统一

小舟谈历史
2026-03-19 17:27:44
那个贪了一辈子的人,最后把自己炸成了忠烈!

那个贪了一辈子的人,最后把自己炸成了忠烈!

历史按察使司
2026-03-20 11:57:07
特朗普宣布成功解决了伊朗问题,摧毁了全部核设施,美国大获全胜?Fake news!

特朗普宣布成功解决了伊朗问题,摧毁了全部核设施,美国大获全胜?Fake news!

回旋镖
2026-03-19 21:01:07
年薪60万男子找36名同事借款200万被辞退,起诉公司索赔240多万

年薪60万男子找36名同事借款200万被辞退,起诉公司索赔240多万

半岛晨报
2026-03-20 21:30:03
常州首富汪立平被留置:从技术员到千亿液压件龙头创始人

常州首富汪立平被留置:从技术员到千亿液压件龙头创始人

澎湃新闻
2026-03-20 18:02:26
油价一夜突变!3月19日全国油价调整后92/95汽油价格、0号柴油价格最新公布

油价一夜突变!3月19日全国油价调整后92/95汽油价格、0号柴油价格最新公布

沙雕小琳琳
2026-03-19 15:51:07
时隔7年锁定季后赛!马刺险胜太阳4连胜 文班34+12准绝杀

时隔7年锁定季后赛!马刺险胜太阳4连胜 文班34+12准绝杀

醉卧浮生
2026-03-20 10:31:22
图们江俄朝新大桥建成,彻底锁死中国东北出海口,俄朝为何这么做

图们江俄朝新大桥建成,彻底锁死中国东北出海口,俄朝为何这么做

阿胡
2026-03-20 11:13:28
山姆回应调整退货政策:新政策不涉及退货期调整

山姆回应调整退货政策:新政策不涉及退货期调整

界面新闻
2026-03-20 15:17:21
恩佐:马雷斯卡给我们清晰的战术体系,他的离开我们无比难过

恩佐:马雷斯卡给我们清晰的战术体系,他的离开我们无比难过

懂球帝
2026-03-21 06:12:10
现车全部下架!特斯拉Model Y“卖空”背后是……

现车全部下架!特斯拉Model Y“卖空”背后是……

国际金融报
2026-03-19 16:25:11
德云社目前真实现状!很多人都在犹豫是去是留,老郭为啥还要招人

德云社目前真实现状!很多人都在犹豫是去是留,老郭为啥还要招人

奇怪的鲨鱼们
2026-03-20 09:13:29
等我老了,也学日本主妇:少穿卫衣、毛衣,换成这样穿更优雅减龄

等我老了,也学日本主妇:少穿卫衣、毛衣,换成这样穿更优雅减龄

冒泡泡的鱼儿
2026-03-18 14:40:23
唏嘘!49岁前中超名将送外卖:1天收入三四百 李玮锋知情后伸援手

唏嘘!49岁前中超名将送外卖:1天收入三四百 李玮锋知情后伸援手

观察鉴娱
2026-03-16 09:36:46
菲律宾把中国当伊朗?2架飞机入侵黄岩岛,被解放军出手赶跑

菲律宾把中国当伊朗?2架飞机入侵黄岩岛,被解放军出手赶跑

春序娱乐
2026-03-21 07:56:59
装钱的麻袋都不够了!俄罗斯每天多挣500亿,四年战争,一朝回血

装钱的麻袋都不够了!俄罗斯每天多挣500亿,四年战争,一朝回血

奥字侃剧
2026-03-21 04:22:27
2026-03-21 08:35:00
deephub incentive-icons
deephub
CV NLP和数据挖掘知识
1954文章数 1458关注度
往期回顾 全部

科技要闻

宇树招股书拆解,人形机器人出货量第一!

头条要闻

北约决定从伊拉克撤出所有人员 被特朗普大骂"纸老虎"

头条要闻

北约决定从伊拉克撤出所有人员 被特朗普大骂"纸老虎"

体育要闻

6年前的一场悲剧,造就了“法国瓦尔迪”

娱乐要闻

总台首届电影盛典,“沈马”CP再合体

财经要闻

拆解宇树:一年营收17亿 机器人卖给了谁

汽车要闻

何小鹏坦白局:每月3亿的“慌”与通向L4的坚定

态度原创

游戏
本地
亲子
时尚
公开课

《AC影》发售一周年 开发者:我很骄傲 能发售已是奇迹

本地新闻

春色满城关不住|绍兴春日顶流,这片樱花海藏不住了

亲子要闻

为什么有钱人家孩子一般长相都不错?网友:要有钱有闲

推广中奖名单-更新至2026年3月4日推广

公开课

李玫瑾:为什么性格比能力更重要?

无障碍浏览 进入关怀版