Courseiva
Exploratory Data AnalysismediumMultiple ChoiceObjective-mapped

MLS-C01 Exploratory Data Analysis Practice Question

A data scientist is building a regression model to predict house prices. The dataset includes a feature 'zip_code' with 1,000 unique values. What is the best way to handle this categorical feature in the exploratory data analysis phase?

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

Apply target encoding using the mean house price per zip code

Target encoding (option B) is the best approach for high-cardinality categorical features like zip_code. It captures the relationship between the category and the target variable (house price) without creating an excessive number of dummy variables. One-hot encoding (option A) would create 1,000 columns, leading to high dimensionality and sparsity. Label encoding (option D) implies an ordinal relationship, which does not exist for zip codes. Frequency encoding (option C) may not capture price variation well because two zip codes with the same frequency could have very different average prices.

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 zip_code feature

    Why it's wrong here

    One-hot encoding would create too many dummy variables (1,000 columns), leading to high dimensionality and sparsity, which is not ideal for a regression model.

  • Apply target encoding using the mean house price per zip code

    Why this is correct

    Target encoding uses the mean house price per zip code, effectively capturing the relationship between zip code and the target while keeping dimensionality low.

  • Replace zip_code with the frequency of each zip code in the dataset

    Why it's wrong here

    Frequency encoding replaces categories with their occurrence counts, which may not correlate well with house prices and can lose information about price differences.

  • Use label encoding: assign each zip code a unique integer

    Why it's wrong here

    Label encoding assigns arbitrary integer values, implying an ordinal relationship among zip codes, which is not meaningful and can mislead the model.

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.