@
CrabAss 大佬,我又来打扰您了,我现在做到那个模型评估那里,其中有两个指标
print('准确率:', accuracy_score(Y_test, y_pred))
print('精确率:', precision_score(Y_test, y_pred))
第一条可以运行出来,第二条会报错
准确率: 0.900968992248062
F:\anaconda\envs\scikit-learn\lib\site-packages\sklearn\metrics\
classification.py:1243: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
if pos_label not in present_labels:
Traceback (most recent call last):
File "F:/bigdata/scikit-learn/
Dataset.py", line 97, in <module>
print('正确率:', precision_score(Y_test, y_pred))
File "F:\anaconda\envs\scikit-learn\lib\site-packages\sklearn\metrics\
classification.py", line 1569, in precision_score
sample_weight=sample_weight)
File "F:\anaconda\envs\scikit-learn\lib\site-packages\sklearn\metrics\
classification.py", line 1415, in precision_recall_fscore_support
pos_label)
File "F:\anaconda\envs\scikit-learn\lib\site-packages\sklearn\metrics\
classification.py", line 1246, in _check_set_wise_labels
"%r" % (pos_label, present_labels))
ValueError: pos_label=1 is not a valid label: array(['buffer', 'play'], dtype='<U6')
进程已结束,退出代码 1
请问这是为什么?