Courseiva
Exploratory Data AnalysishardMultiple ChoiceObjective-mapped

MLS-C01 Exploratory Data Analysis Practice Question

A machine learning engineer is analyzing a dataset that contains a categorical feature 'country' with 200 unique values. The target variable is binary. The engineer wants to use this feature in a linear model. Which encoding method should be applied during EDA to prepare the data for modeling, considering the high cardinality?

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

Target encoding with cross-validation

Target encoding with cross-validation (Option A) is the correct choice for this scenario because it replaces each category in the high-cardinality feature 'country' with the mean of the target variable, effectively capturing the relationship with the target while avoiding the curse of dimensionality. Cross-validation is essential to prevent overfitting by computing the target means on out-of-fold data. One-hot encoding (Option D) would create 199 dummy variables, leading to high dimensionality and potential overfitting, making it unsuitable for linear models with limited data. Label encoding (Option B) imposes an arbitrary ordinal relationship that the linear model would misinterpret. Frequency encoding (Option C) may not capture the relationship with the target and could lose predictive power.

Answer analysis

Option-by-option breakdown

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

  • Target encoding with cross-validation

    Why this is correct

    Target encoding captures the relationship with the target, and cross-validation prevents data leakage.

  • Label encoding

    Why it's wrong here

    Label encoding assumes an ordinal relationship that does not exist.

  • Frequency encoding

    Why it's wrong here

    Frequency encoding uses count but may lose predictive information.

  • One-hot encoding

    Why it's wrong here

    One-hot encoding creates too many features, which can cause the curse of dimensionality.

About these practice questions

This MLS-C01 question is part of Courseiva's 1,672-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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 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.