在使用sklearn.metrics中的classification_report, confusion_matrix分别报了如下的错误:
TypeError: iteration over a 0-d tensor
Specify that at least one label must be in y_true
调用语句:
classification_report(y_true, y_pred, target_names=target_names, zero_division=0)
找了很久确定自己y_true和y_pred没有问题,发现去掉target_names=target_names即可正常运行,不是很确定为什么,但是至少现在能跑了
即改为
classification_report(y_true, y_pred, zero_division=0)