Python 为什么准确度没有';你不会被打印出来吗?

Python 为什么准确度没有';你不会被打印出来吗?,python,machine-learning,scikit-learn,classification,svm,Python,Machine Learning,Scikit Learn,Classification,Svm,所以下面的代码永远不会打印精度 1 #!/usr/bin/python 2 3 """. 4 This is the code to accompany the Lesson 2 (SVM) mini-project. 5 6 Use a SVM to identify emails from the Enron corpus by their authors:.... 7 Sara has label 0 8 Chris ha

所以下面的代码永远不会打印精度

  1 #!/usr/bin/python
  2 
  3 """.
  4     This is the code to accompany the Lesson 2 (SVM) mini-project.
  5 
  6     Use a SVM to identify emails from the Enron corpus by their authors:....
  7     Sara has label 0
  8     Chris has label 1
  9 """
 10 ....
 11 import sys
 12 from time import time
 13 sys.path.append("../tools/")
 14 from email_preprocess import preprocess
 15 from sklearn import svm
 16 from sklearn.metrics import accuracy_score
 17 
 18 
 19 ### features_train and features_test are the features for the training
 20 ### and testing datasets, respectively
 21 ### labels_train and labels_test are the corresponding item labels
 22 features_train, features_test, labels_train, labels_test = preprocess()
 23 clf=svm.SVC(kernel='linear')
 24 clf.fit(features_train, labels_train)
 25 pred=clf.predict(features_test)
 26 print(accuracy_score(labels_test, pred))

我试图找出为什么行
打印(准确度评分(标签测试,pred))
根本不打印任何内容。它应该打印一些值。有什么问题吗?

我添加了这行代码,它可以打印一些东西。我见过人们通常使用1000次迭代:

clf=svm.SVC(kernel='linear',max_iter=100)

运行脚本时,控制台中是否出现任何错误?您希望它打印什么值?请冷静。我只是想快速了解您面临的问题。^指投票结束该问题的人@vcp