Courseiva
ModelinghardMultiple ChoiceObjective-mapped

MLS-C01 Modeling Practice Question

A data scientist is using SageMaker to train an XGBoost model for regression. The training data contains categorical features with high cardinality (e.g., zip code with over 10,000 unique values). Which feature engineering approach is MOST appropriate to avoid overfitting while preserving predictive power?

⚠ Common exam trap

A common mix-up: candidates default to one-hot encoding for categorical features, not realizing that high cardinality makes it computationally infeasible and prone to overfitting, while target encoding with smoothing offers a compact and powerful alternative.

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 target encoding with smoothing

Target encoding with smoothing is the most appropriate approach because it replaces each high-cardinality category with the mean of the target variable for that category, regularized by a smoothing factor that pulls estimates toward the global mean. This preserves predictive power by capturing the relationship between the category and the target while preventing overfitting on rare categories that have few samples. In SageMaker XGBoost, this avoids the curse of dimensionality from one-hot encoding and the arbitrary ordering from label encoding.

Answer analysis

Option-by-option breakdown

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

  • Use target encoding with smoothing

    Why this is correct

    Target encoding captures category-target relationship with regularization to avoid overfitting.

  • One-hot encode the categorical features

    Why it's wrong here

    One-hot encoding creates excessive features, leading to sparsity and overfitting.

  • Apply frequency encoding based on category occurrence

    Why it's wrong here

    Frequency encoding may not capture target-specific patterns.

  • Label encode the categorical features

    Why it's wrong here

    Label encoding assumes ordinality, which may not exist.

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.