Courseiva
Data Preparation for Machine LearningmediumMultiple ChoiceObjective-mapped

MLA-C01 Data Preparation for Machine Learning Practice Question

A company uses Amazon SageMaker Data Wrangler to create a data flow for a classification model. The dataset contains a high-cardinality categorical feature 'product_id' with 50,000 unique values. The data scientist wants to reduce dimensionality while preserving predictive power. Which approach is most effective?

⚠ Common exam trap

AWS often tests the misconception that feature hashing is always safe for high-cardinality features, but the trap here is that hash collisions can degrade model performance, making target encoding a better choice when the target variable is available and predictive.

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

Perform target encoding by replacing each product ID with the average target value for that product.

Target encoding is the most effective approach for high-cardinality categorical features because it replaces each category with the mean of the target variable, preserving predictive signal while drastically reducing dimensionality. In SageMaker Data Wrangler, this can be implemented using the 'Encode categorical' transform with the 'Target encoding' option, which avoids the explosion of features caused by one-hot encoding and retains the relationship between product IDs and the target.

Answer analysis

Option-by-option breakdown

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

  • Apply one-hot encoding to the 'product_id' column.

    Why it's wrong here

    50,000 dummy variables lead to extreme dimensionality and risk overfitting.

  • Perform target encoding by replacing each product ID with the average target value for that product.

    Why this is correct

    Target encoding condenses information into a single numerical feature while retaining predictive signals.

  • Use feature hashing to map product IDs to a fixed number of buckets (e.g., 100).

    Why it's wrong here

    Hashing can cause collisions and loss of interpretability.

  • Drop the 'product_id' column entirely.

    Why it's wrong here

    The feature may have predictive value; dropping is too aggressive.

About these practice questions

One of 835 original MLA-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 MLA-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 MLA-C01 exam.