How can a grid search compare keeping and removing an intermediate dimensionality-reduction step?
Classic MLLevel: IntermediatePipeline ablation
How can a grid search compare keeping and removing an intermediate dimensionality-reduction step?
Hints
- A step itself can be a parameter.
- Not every parameter exists for every candidate.
Answer
Search that step over estimator instances and 'passthrough'. Keep parameter grids conditional so parameters for a removed or replaced estimator are not applied incorrectly.
Source and licence: scikit-learn 1.7.2 — compose · BSD-3-Clause · answer: Quantoros editorial