You have a dataset of supplier locations recorded as two-letter country codes (for example, NZ for New Zealand). You must convert these codes into numeric variables for model training while (1) avoiding any information loss and (2) minimizing the increase in dimensionality. Which transformation meets these requirements?
Choose an answer
Tap an option to check your answer.
Correct answer: Convert the two-letter country codes into numeric features using similarity encoding..
Why this is the answer
Similarity encoding is the most appropriate transformation because it converts categorical features into numerical representations while preserving information about the relationships between categories. It assigns numerical values based on the similarity of the categories, which minimizes information loss. This method also avoids the high dimensionality that one-hot encoding introduces, especially with many unique categories. Adding a new column with full country names only changes the representation, not the type, and doesn't make it numeric for model training. Mapping to continent names loses granular information about individual countries, violating the "avoiding information loss" requirement. One-hot encoding creates a new binary column for each unique country code, significantly increasing dimensionality and potentially leading to the "curse of dimensionality" if there are many countries.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed