I was working through a tutorial on the titanic disaster from Kaggle and I'm getting different results depending on the details of how I use
If I call it like:
scores = cross_validation.cross_val_score(alg, titanic[predictors], titanic["Survived"], cv=3) print(scores.mean()) 0.801346801347
I get a different set of scores than if I call it like:
kf = KFold(titanic.shape, n_folds=3, random_state=1) scores = cross_validation.cross_val_score(alg, titanic[predictors], titanic["Survived"], cv=kf) print(scores.mean()) 0.785634118967
These numbers are close, but different enough to be significant. As far as I understand, both code snippets are asking for a 3-fold cross validation strategy. Can anyone explain what is going on under the hood of the second example which is leading to the slightly lower score?