A modeller runs cross_val_predict(model, X, y, cv=5) and then computes accuracy on the returned predictions in order to select hyperparameters. What is the main objection?
AIt requires a separate hold-out set and raises NotFittedError when none is supplied alongside cv
BThe predictions are out-of-fold, but the same folds would also drive selection, so the resulting score is not a clean estimateCorrect answer
Ccross_val_predict refits on the full dataset first, so every prediction is in-sample and therefore over-optimistic
DIt returns one aggregate score per fold instead of predictions, so accuracy cannot be computed from its output
Correct answer
B. The predictions are out-of-fold, but the same folds would also drive selection, so the resulting score is not a clean estimate
cross_val_predict returns predictions of the same shape as y, each produced by a model that never trained on that sample, which makes it useful for confusion matrices and residual inspection. It is not a scoring function, though, because choosing hyperparameters from those predictions reintroduces selection bias across the same folds; cross_val_score returns per-fold scores, and GridSearchCV or nested cross-validation keeps selection and estimation separate. Coverage can also be incomplete for some group or time-series splitters.