Courseiva
Exploratory Data AnalysishardMultiple SelectObjective-mapped

Handling High Cardinality Categorical Features — Group Rare Categories

Which TWO statements about handling categorical variables in exploratory data analysis are correct? (Select TWO.)

Quick Answer

The correct answer is that grouping rare categories into a single 'Other' bucket is an effective technique for handling high cardinality categorical features. This approach directly addresses the problem of sparse representations and overfitting, which occur when a categorical variable has too many unique values—such as zip codes or product IDs—relative to the number of training samples. By consolidating infrequent levels into one catch-all group, you reduce dimensionality and noise while preserving the predictive signal from the most common categories. On the AWS Certified Machine Learning Specialty MLS-C01 exam, this concept often appears in questions about feature engineering and data preprocessing, testing your ability to balance model complexity against generalization. A common trap is assuming one-hot encoding alone is always safe; in reality, it can explode the feature space for high-cardinality variables, making the model unstable. Memory tip: think "Rare to One" — when categories are rare, roll them into one.

⚠ Common exam trap

The MLS-C01 exam often tests the misconception that label encoding is safe for nominal data, when in fact it imposes an ordinal relationship that can distort model performance.

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

When a categorical feature has high cardinality, consider grouping rare categories.

High-cardinality categorical features can lead to overfitting and sparse representations. Grouping rare categories into a single 'Other' bucket reduces dimensionality and noise, improving model generalization without losing significant predictive signal.

Answer analysis

Option-by-option breakdown

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

  • When a categorical feature has high cardinality, consider grouping rare categories.

    Why this is correct

    Grouping reduces dimensionality and overfitting.

  • Target encoding always avoids data leakage.

    Why it's wrong here

    Target encoding can leak target information if not cross-validated.

  • One-hot encoding creates binary columns for each category.

    Why this is correct

    One-hot encoding represents categories as binary vectors.

  • Label encoding is suitable for nominal categorical variables.

    Why it's wrong here

    Label encoding imposes an ordinal order, which may mislead models.

  • Categorical variables should always be dropped if they have many unique values.

    Why it's wrong here

    They may contain predictive value; consider encoding or grouping.

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

Same concept, more angles

1 more way this is tested on MLS-C01

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. Which TWO actions are appropriate during exploratory data analysis when you discover that a categorical feature has 50 unique values (high cardinality)?

medium
  • A.Group rare categories into a single 'Other' category.
  • B.Apply one-hot encoding to create 50 dummy variables.
  • C.Apply label encoding to assign integers to each category.
  • D.Drop the feature entirely.
  • E.Use feature hashing (hashing trick) to reduce dimensionality.

Why A: Options A and E are correct. A: Grouping rare categories into an 'Other' category reduces cardinality while preserving information, which is appropriate for high-cardinality categorical features. E: Feature hashing (hashing trick) transforms high-cardinality features into a fixed-size vector, reducing dimensionality. Option B is incorrect because one-hot encoding with 50 categories creates many sparse columns, which can be problematic for model performance and memory. Option C is incorrect because label encoding implies an ordinal relationship, which may not exist, and can mislead models. Option D is incorrect because dropping the feature may lose important information; other techniques like grouping or hashing are preferable.

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.