MLA-C01 Data Preparation for Machine Learning Practice Question
A data scientist needs to convert categorical variables to numerical format for a linear regression model. The dataset contains a 'Country' column with 50 unique values. Which transformation should the engineer use to avoid introducing ordinal relationships?
⚠ Common exam trap
AWS often tests the distinction between label encoding and one-hot encoding, trapping candidates who assume integer mapping is harmless for linear models without recognizing the ordinal bias it introduces.
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
✓
One-hot encoding
One-hot encoding is correct because it creates binary columns for each category, avoiding any implicit ordinal relationship between the 50 unique countries. This is essential for linear regression, which assumes numerical inputs have meaningful order; one-hot encoding ensures the model treats each country as an independent category without ranking.
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 ordinal values, which can be misinterpreted by linear models.
- ✗
Target encoding
Why it's wrong here
Target encoding uses the target variable to encode categories, risking data leakage and overfitting.
- ✓
One-hot encoding
Why this is correct
Correct because it creates binary columns without ordinality.
- ✗
Ordinal encoding
Why it's wrong here
Ordinal encoding implies an order that does not exist for countries.
Go deeper
Related to this question
About these practice questions
This MLA-C01 question is part of Courseiva's 835-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 →
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.