from sklearn.metrics import adjusted_mutual_info_score
import numpy as np
a = np.random.randint(0,2,30000000)
b = np.random.randint(0,2,30000000)
print(a.shape)
print(b.shape)
c = adjusted_mutual_info_score(a,b)
print(c)
如果运行以下代码,您将退出:
RuntimeWarning: invalid value encountered in log
log_outer = -np.log(outer) + log(pi.sum()) + log(pj.sum())
nan
我不明白为什么会这样,但是如果您制作1000个值的较小集合,则一切运行正常。谁能告诉我发生了什么事以及如何解决这个问题?我会很感激的。