NCA-GENL - Data Analysis and Visualization - Section 4.4

Apply essential machine learning techniques for data preparation.

Apply essential data preparation techniques including handling missing values, feature scaling, categorical encoding, and train-validation-test splitting to produce clean, model-ready datasets. Understand how poor data preparation introduces bias or data leakage, and recognise the steps that must occur before training begins.

Practice question for this objective

Free sampleData Analysis and Visualizationeasy

A data scientist splits a labelled dataset and then fits a StandardScaler on the combined training and test sets before applying it to both. What problem does this introduce?

  • AThe model will underfit because scaling reduces the variance of the features.
  • BThe validation split becomes unnecessary because scaling already regularises the model.
  • CCategorical features get converted to float values, causing label encoding errors.
  • DData leakage occurs because statistics from the test set influence the training transformation. Correct
Understand why a preprocessing scaler must be fitted only on training data to avoid data leakage into evaluation. Data leakage in preprocessing happens when statistics computed on held-out data (test or validation) are used to transform training data. Fitting a StandardScaler on the full dataset before splitting means the scaler's mean and standard deviation encode test-set information, so the model is effectively trained on transformed features that were shaped by data it should never have seen. The correct practice is to fit the scaler exclusively on the training split and then apply (transform only) it to the validation and test splits.

Why A is wrong: Scaling does not inherently cause underfitting; it changes the numeric range of features, not their information content. Conflating scale with variance loss is a common misconception, but it is not the issue introduced by fitting on combined data.

Why B is wrong: Scaling is a preprocessing step that normalises feature ranges; it performs no regularisation and does not replace the need for a held-out validation split. Conflating the two concepts is tempting but incorrect.

Why C is wrong: StandardScaler operates on numeric columns; applying it to categorical columns is a separate concern and not the problem introduced by fitting the scaler across both splits. The described error is a red herring about a different preprocessing stage.

Why D is correct: Fitting the scaler on both splits lets the mean and standard deviation absorb information from the test set. When the model trains with those parameters, it has indirectly seen test distribution information, giving an overly optimistic evaluation.

See more NCA-GENL practice questions, answers explained.

More in this domain

Back to all Data Analysis and Visualization objectives, or the NCA-GENL cert hub.

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