我在 scikit-learn 中使用度量模型中的“roc_curve”。该示例显示'roc_curve'
应该在'auc'
类似于之前调用:
fpr, tpr, thresholds = metrics.roc_curve(y, pred, pos_label=2)
接着:
metrics.auc(fpr, tpr)
但是会返回以下错误:
Traceback (most recent call last): File "analysis.py", line 207, in <module>
r = metrics.auc(fpr, tpr) File "/apps/anaconda/1.6.0/lib/python2.7/site-packages/sklearn/metrics/metrics.py", line 66, in auc
x, y = check_arrays(x, y) File "/apps/anaconda/1.6.0/lib/python2.7/site-packages/sklearn/utils/validation.py", line 215, in check_arrays
_assert_all_finite(array) File "/apps/anaconda/1.6.0/lib/python2.7/site-packages/sklearn/utils/validation.py", line 18, in _assert_all_finite
raise ValueError("Array contains NaN or infinity.") ValueError: Array contains NaN or infinity.
它在术语或结果方面意味着什么/有没有办法克服这个问题?