A data scientist is building a cuML pipeline on a GPU cluster. After splitting data into train and test sets, they want to remove features whose variance falls below a threshold and then apply mutual information scoring to rank the survivors. Which practice is essential to prevent target leakage when fitting these two selection steps?
- AFit the variance threshold and mutual information selector on the combined train-plus-test data so that the full feature distribution is captured accurately.
- BFit the variance threshold and mutual information selector on the training set only, then apply the fitted selector to transform both the training and test sets. Correct
- CFit the variance threshold on the training set but fit the mutual information selector on the test set, because mutual information requires the true label distribution to score features.
- DApply the variance threshold before the train-test split and fit the mutual information selector on the training set, treating the two steps as independent preprocessing stages.
Why A is wrong: Fitting on combined train and test data causes target leakage because test-set statistics influence which features are retained, making evaluation results optimistic and unreliable in production.
Why B is correct: Fitting selection steps exclusively on the training set ensures that no information from the test set contaminates the selection criteria, preserving the integrity of the held-out evaluation and reflecting how the pipeline would behave on unseen data.
Why C is wrong: Using test-set labels to fit the mutual information scorer leaks target information from the held-out set into the selection step, which invalidates the evaluation and produces overly optimistic performance estimates.
Why D is wrong: Applying variance thresholding before splitting means the threshold is influenced by test-set variance, which is a subtle form of leakage. Both selection steps must be fitted strictly after the train-test split and only on training data.