Courseiva
Exploratory Data AnalysismediumMultiple ChoiceObjective-mapped

MLS-C01 Exploratory Data Analysis Practice Question

A data scientist is using Amazon SageMaker to train a model. The training dataset contains missing values in several features. The data scientist wants to impute missing values using the median of each feature. Which approach is most appropriate?

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

Compute the median of each feature on the training set only, then impute both training and test sets using that median

Computing the median on the training set only avoids data leakage, and applying that median to both training and test sets ensures consistent imputation without using test set information. Option A is incorrect because dropping rows with missing values discards potentially useful data and is not imputation. Option B is incorrect because computing the median on the entire dataset before splitting introduces data leakage, as the test set influences the imputation values. Option C is incorrect because imputing with zero is arbitrary and does not use the median; also, doing it before splitting would use the entire dataset, causing leakage.

Answer analysis

Option-by-option breakdown

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

  • Drop all rows that contain missing values

    Why it's wrong here

    Dropping rows discards potentially useful data and is not imputation; it may lead to loss of information and is not a preferred method for handling missing values.

  • Compute the median on the entire dataset, then split into training and test sets

    Why it's wrong here

    Computing the median on the entire dataset before splitting introduces data leakage because the test set influences the imputation values, violating the principle of not using test set information.

  • Impute missing values with zero for all features before splitting

    Why it's wrong here

    Imputing with zero is arbitrary and does not use the median; also, doing it before splitting uses the entire dataset, causing data leakage.

  • Compute the median of each feature on the training set only, then impute both training and test sets using that median

    Why this is correct

    Computing the median on the training set only avoids data leakage, and applying that median to both training and test sets ensures consistent imputation without using test set information.

About these practice questions

One of 1,672 original MLS-C01 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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 MLS-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 MLS-C01 exam.