Courseiva
ModelingmediumMultiple ChoiceObjective-mapped

MLS-C01 Modeling Practice Question

A data scientist is using Amazon SageMaker to train a model on a dataset that contains both numerical and categorical features. The categorical features have high cardinality (e.g., postal codes, product IDs). Which feature engineering approach is most suitable for handling these high-cardinality categorical features in a tree-based model?

⚠ Common exam trap

Many candidates default to one-hot encoding for categorical features without considering the model type, failing to recognize that tree-based models can effectively use label encoding for high-cardinality features without the drawbacks of dimensionality explosion.

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 label encoding

Label encoding is suitable for tree-based models because these models split on feature values and can handle ordinal relationships implicitly. Unlike linear models, tree-based models do not assume any distance metric between categories, so label encoding avoids the dimensionality explosion of one-hot encoding while preserving the ability to capture splits based on high-cardinality features.

Answer analysis

Option-by-option breakdown

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

  • One-hot encode the categorical features

    Why it's wrong here

    One-hot encoding high-cardinality features creates a huge number of dummy variables, leading to high memory usage and sparse data.

  • Use label encoding

    Why this is correct

    Tree-based models like XGBoost can effectively use label-encoded features because they make splits based on ordering.

  • Apply target encoding

    Why it's wrong here

    Target encoding (mean of target per category) can introduce target leakage and overfitting if not done with cross-validation.

  • Apply binary encoding

    Why it's wrong here

    Binary encoding is possible but not as directly supported; tree models can work with label encoding natively.

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.