Courseiva

AI0-001 Machine Learning and Deep Learning Practice Question

An organization has a dataset with categorical features having high cardinality (e.g., ZIP codes). They plan to use a tree-based model. Which encoding method is most appropriate?

⚠ Common exam trap

CompTIA often tests the misconception that one-hot encoding is always the safest choice for categorical data, but the trap here is that high cardinality makes one-hot encoding impractical, and candidates overlook target encoding as a cardinality-efficient 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

✓

Target encoding (mean encoding)

Target encoding (mean encoding) replaces each category with the mean of the target variable for that category, which works well with tree-based models on high-cardinality features because it captures the predictive signal without exploding the feature space. This method avoids the dimensionality explosion of one-hot encoding and the arbitrary ordering of label encoding, making it the most appropriate choice for high-cardinality categorical features in tree-based models.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Label encoding

    Why it's wrong here

    Label encoding assigns arbitrary integers, implying order that misleads tree splits.

  • ✗

    One-hot encoding

    Why it's wrong here

    One-hot encoding creates high-dimensional sparse data, which can degrade tree performance.

  • ✓

    Target encoding (mean encoding)

    Why this is correct

    Target encoding maps categories to the mean target, preserving predictive information compactly.

  • ✗

    Frequency encoding

    Why it's wrong here

    Frequency encoding uses category counts; target encoding is more directly predictive.

About these practice questions

One of 962 original AI0-001 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 AI0-001 practice question is part of Courseiva's free CompTIA 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 AI0-001 exam.