python3.6.5出现了一个问题
from data import get_train_test_splitfrom model import *
from sklearn.metrics import accuracy_score,confusion_matrix,recall_score, f1_score
from sklearn.model_selection import cross_val_score
pipeline = get_naive_bayes_model()
X_train, X_test, y_train, y_test = get_train_test_split()
pipeline.fit(X_train, y_train)
cv_scores = cross_val_score(pipeline, X_train, y_train, cv=5)
print cv_scores 这个地方报错
predicted = pipeline.predict(X_test) # ['spam', 'ham']
print confusion_matrix(y_test, predicted)
print 'accuracy_score', accuracy_score(y_test, predicted)
print 'f1_score', f1_score(y_test, predicted)
print 'recall_score', recall_score(y_test, predicted) #输出confusion matrix,并加入cross_validation, 以全面检测模型性能
倒数第六行报错,我不知道怎么改了,求助 print是函数,需要小括号的,没有括号的写法是2.x语法 为什么Python问题要提在Java里呢 我也很好奇,为什么不去Python版块提问呢
print没有小扩号 不会起名字的我 发表于 2021-5-24 19:06
为什么Python问题要提在Java里呢
py前些年玩过,现在:啥叫py?{:5_98:}
页:
[1]