为什么我使用 cross val 分数得到零分?

Why am i getting a score of zero using cross val score?

When i run this proccessing with 10 fold cross-validation,prediction results is precisely opposite of label datas and i get zero accuracy.I can not solve why is that?

kfold = model_selection.KFold(n_splits=5,random_state=+7,shuffle=False)
predictions = model_selection.cross_val_predict(SVC(),features_list,labels_list,cv=kfold)
accuracy=metrics.accuracy_score(labels_list,predictions)
print(confusion_matrix(labels_list,predictions))
print(classification_report(labels_list,predictions))
print("Accuracy Score:",accuracy)

不要使用 cross_val_predict 评估 scikit-learn 中的模型(那里的警告部分:https://scikit-learn.org/stable/modules/cross_validation.html#obtaining-predictions-by-cross-validation

相反,使用 cross_val_score 这将 return 10 个模型在交叉验证构建的 10 个不同数据集上测试的 10 个准确度。查看平均分数和标准差。开发者求评价。