NCA-ADS - Data Science Pipelines and Workflow Automation - Section 3.2

Apply feature engineering and feature selection.

Create new features and remove low-value ones through methods such as correlation filtering, mutual information scoring, and wrapper-based selection. Understand how embedding feature selection inside a pipeline prevents leakage across cross-validation folds.

Practice question for this objective

Free sampleData Science Pipelines and Workflow Automationmedium

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.
Identify the correct fitting strategy for filter-based feature selection steps to avoid data leakage in a cuML pipeline. Feature selection steps are statistical estimators: they learn thresholds, scores, or rankings from the data they are fitted on. If any part of the test set is included during fitting, the selector is implicitly informed by the held-out distribution, a form of target leakage that produces overly optimistic evaluation metrics. The correct pattern mirrors scikit-learn and cuML pipeline conventions: call fit or fit_transform on the training set, then call transform on the test set using the already-fitted selector. This applies to filter methods such as variance threshold and mutual information, wrapper methods such as recursive feature elimination, and embedded methods such as L1-regularised model coefficients.

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.

See more NCA-ADS practice questions, answers explained.

More in this domain

Back to all Data Science Pipelines and Workflow Automation objectives, or the NCA-ADS cert hub.

Examworthy is not affiliated with or endorsed by NVIDIA. Original, blueprint-aligned practice material only.