Courseiva

MLA-C01 Data Preparation for Machine Learning Practice Question

A machine learning engineer is preparing a dataset for a binary classification model. The dataset has 10,000 rows and 200 features, with 5% positive class. The engineer suspects class imbalance may affect model performance. Which TWO actions should the engineer take to mitigate imbalance? (Choose 2.)

⚠ Common exam trap

Candidates often confuse techniques for handling class imbalance with general data preprocessing or evaluation methods, leading them to select PCA or cross-validation as solutions, when in fact only resampling (SMOTE) and cost-sensitive learning (class weights) directly address the imbalance problem.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Apply SMOTE only to training data

Option D is correct because SMOTE (Synthetic Minority Over-sampling Technique) generates synthetic samples of the minority class and must be applied only to the training data to avoid data leakage into validation/test folds, directly addressing the 5% positive-class imbalance. Option E is correct because setting class weights in the algorithm (e.g., class_weight='balanced' in scikit-learn) penalizes misclassification of the minority class more heavily, which mitigates imbalance without altering the dataset. Option A is incorrect because PCA is a dimensionality-reduction technique for the 200 features and does nothing to change the 5% class ratio. Option B is incorrect because removing low-variance features is a feature-selection step unrelated to class distribution. Option C is incorrect because k-fold cross-validation is an evaluation/resampling strategy that provides more reliable performance estimates but does not itself rebalance classes.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Perform PCA to reduce dimensions

    Why it's wrong here

    PCA reduces dimensionality to address the 200 features, but it does not change the 5% positive rate, so imbalance persists. It is the right choice for multicollinearity or training-time concerns; here resampling, class weights or threshold tuning are needed.

  • ✗

    Remove features with low variance

    Why it's wrong here

    Variance filtering drops near-constant columns, which is feature selection unrelated to the 5% positive rate. It suits high-dimensional noisy data; imbalance requires resampling, class weighting or threshold adjustment, which alter the class distribution the model sees.

  • ✗

    Use k-fold cross-validation

    Why it's wrong here

    K-fold cross-validation gives a more reliable performance estimate across folds but leaves the 5% positive rate untouched in every training split. It is correct for model selection and variance estimation, not for correcting class imbalance itself.

  • ✓

    Apply SMOTE only to training data

    Why this is correct

    SMOTE synthesises new minority-class observations by interpolating between nearest minority neighbours. Restricting it to the training split keeps those synthetic points out of validation and test data, preventing the leakage and inflated metrics that applying it before splitting would produce.

  • ✓

    Use class weights in the algorithm

    Why this is correct

    Class weights scale each class's contribution to the loss function, so the 5% positive class penalises misclassification more heavily. This rebalances learning without altering the underlying rows, preserving the original feature distribution and avoiding the leakage risks of synthetic oversampling.

About these practice questions

Courseiva writes every MLA-C01 question from scratch — 665 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This MLA-C01 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the MLA-C01 exam.