QuestionQ87

VerifiedModel Development

A machine learning engineer needs to scale a machine learning pipeline pipeline that includes multiple feature-engineering stages and a modeling stage. During cross-validation, they use the following code block:

Question Image

A colleague proposes speeding up tuning by passing the model object to the estimator parameter and placing the updated cv object as the pipeline’s final stage instead of the original model. What is a negative consequence of the colleague’s proposed approach?

Explanation

Putting cross-validation after the feature-engineering stages causes the enclosing pipeline to fit any feature-engineering estimators on the entire dataset before the folds are created for model tuning. Consequently, information from validation records can affect the engineered features used for training and evaluation, producing data leakage. Spark pipelines execute and fit stages in order, while cross-validation evaluates an estimator on separate training and test folds.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!