Courseiva
Exploratory Data AnalysishardMultiple ChoiceObjective-mapped

MLS-C01 Exploratory Data Analysis Practice Question

A data scientist is performing EDA on a dataset of customer churn. The dataset includes a categorical feature 'Region' with 100 unique values. What is the best way to encode this feature for a tree-based model?

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

Use the feature as a categorical variable directly in the tree-based model

Many tree-based model implementations (e.g., LightGBM, CatBoost) support categorical features natively, handling high cardinality without encoding. Option A is wrong because frequency encoding can introduce target leakage if applied without proper cross-validation. Option C is wrong because label encoding imposes an ordinal relationship that the tree might misinterpret. Option D is wrong because one-hot encoding with 100 categories creates many sparse columns, leading to inefficiency and potential overfitting.

Answer analysis

Option-by-option breakdown

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

  • Replace each category with its frequency in the dataset

    Why it's wrong here

    Frequency encoding can be useful but may not be optimal for trees; also risks target leakage if not careful.

  • Use the feature as a categorical variable directly in the tree-based model

    Why this is correct

    Many tree-based models (e.g., LightGBM, CatBoost) handle high-cardinality categoricals efficiently.

  • Label encode the feature (assign integers 0-99)

    Why it's wrong here

    Label encoding implies ordinal relationship, which may mislead tree splits.

  • One-hot encode the feature

    Why it's wrong here

    One-hot encoding with 100 categories creates many columns, increasing memory and sparsity.

About these practice questions

Courseiva writes every MLS-C01 question from scratch — 1,672 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 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.