有人可以告诉我这是什么样的错误以及如何解决这个问题(如图所示)
,这是错误消息
Traceback (most recent call last):
File "ep5pipeline.py", line 57, in <module>
print (accuracy_score(y_test,predictions, normalize = False))
File "//anaconda/lib/python3.6/site-packages/sklearn/metrics/classification.py", line 172, in accuracy_score
y_type, y_true, y_pred = _check_targets(y_true, y_pred)
File "//anaconda/lib/python3.6/site-packages/sklearn/metrics/classification.py", line 72, in _check_targets
check_consistent_length(y_true, y_pred)
File "//anaconda/lib/python3.6/site-packages/sklearn/utils/validation.py", line 181, in check_consistent_length
" samples: %r" % [int(l) for l in lengths])
ValueError: Found input variables with inconsistent numbers of samples: [75, 1]
答案 0 :(得分:1)
在函数predict()中,return predictions
应该出现在&#34; for&#34;迭代。
此外,像Neil说的那样,最好发布源代码。