该问题可以通过将dtype参数从int64更改为float64来解决。以下是使用numpy库中的adjusted_rand_score函数的示例代码:
import numpy as np from sklearn.metrics import adjusted_rand_score
labels_true = np.random.randint(0, 2, size=100) labels_pred = np.random.randint(0, 2, size=100)
score = adjusted_rand_score(labels_true, labels_pred, average_method='arithmetic', sample_weight=None)
print(score)
如果代码中遇到溢出错误,请尝试更改adjusted_rand_score函数的dtype参数。
上一篇:Adjustdownloadbuttontodownloadtwotables
下一篇:adjusted_rand_score函数中出现的问题:“在长整型标量(tp+fp)*(fp+tn)中出现了溢出