問題文
A team wants to tune a GBTClassifier that sits at the end of a Pipeline containing a StringIndexer and a VectorAssembler. They are worried about leakage from the preparation steps into the validation folds. Where should the CrossValidator be placed?
選択肢
- Wrap the entire Pipeline in the CrossValidator, so that every fold re-fits the preparation stages on that fold's training portion only.
- Fit the preparation stages once on the full training set, then cross-validate only the classifier on the transformed output, reusing that one fit.
- Place a CrossValidator inside the Pipeline as one of its stages, positioned before the classifier, so each fold sees it run.
- Skip cross-validation and rely on a single train-validation split, because a Pipeline already isolates the preparation stages from the validation data.