O'Reilly logo
  • Richard Xie thinks this is interesting:

scores = cross_val_score(clf1, X, y, cv=3,scoring='accuracy', n_jobs=-1)


Cover of Python: Real World Machine Learning


This is wrong. You are using the testing data to do the cross-validation. You should have used accuracy = accuracy_score(y, pred2) to compute the prediction accuracy. Then the true accuracy is around 0.83, not the claimed 0.92.