Pipeline vs GridSearchCV: Predicting after cross‑validation when refit=False
0 reputation · 24 Aug 2022, 07:04 UTC
Goal
Determine whether predictions can be produced after fitting GridSearchCV with refit=False when a Pipeline is used.
Constraints
When refit=False, GridSearchCV does not refit the best estimator on the full training set, so the predict() method raises NotFittedError. This limits accessibility for exploratory workflows that require predictions during or immediately after cross‑validation.
Uncertainty
Scikit‑learn documentation currently states that predictions are only available when refit=True, and no public plan exists to expose the best estimator from cross‑validation without refitting. The trade‑off between avoiding a full refit and providing usable predictions remains unresolved.
Questions
- Is there a supported method or flag that allows retrieval of the best estimator from a GridSearchCV run with refit=False?
- What would be the computational and memory implications of adding such a feature?
- Could cross_val_predict serve as a viable alternative for obtaining predictions during cross‑validation?