MLS-C01 Question 95
Select 3A data science team is working on a machine learning model for predicting house prices. The dataset contains features such as 'square_footage', 'number_of_bedrooms', 'year_built', and 'zipcode'. The team observes that 'zipcode' has a high cardinality and is not directly interpretable for the model. Which feature engineering techniques can be applied to address this issue?
- A
Perform one-hot encoding on the 'zipcode' feature.
- B
Apply min-max scaling to the 'zipcode' feature.
- C
Group 'zipcode' into broader categories based on geographic regions.
- D
Use target encoding to replace 'zipcode' with the mean house price for each zip code.
- E
Remove the 'zipcode' feature entirely to simplify the model.
Show answer and explanation
Correct answers: A, C, D
Explanation
High-cardinality categorical features like 'zipcode' can pose challenges in machine learning models. Techniques such as one-hot encoding (if cardinality is manageable), grouping into broader categories, or target encoding are effective ways to address this issue. Removing the feature should only be considered if it has no predictive value, which is not indicated in this scenario.
- A. Correct.
One-hot encoding is a common technique for handling categorical features with low to moderate cardinality, making it a suitable option for 'zipcode' if the cardinality is manageable.
- B. Incorrect.
Min-max scaling is primarily used for numerical features to normalize their range. Since 'zipcode' is a categorical feature, this technique is not applicable.
- C. Correct.
Grouping 'zipcode' into broader geographic categories reduces cardinality and can help the model capture regional trends, making it a valid feature engineering approach.
- D. Correct.
Target encoding replaces categorical values with the mean target value for each category, which can be effective but requires caution to avoid data leakage.
- E. Incorrect.
Removing the 'zipcode' feature simplifies the model but is not ideal unless the feature is found to be irrelevant to the prediction task.