MLA-C01 Question 64
Select 2You are building a machine learning model to predict customer churn. Your dataset contains a categorical feature called 'Customer_Type' with the following unique values: 'New', 'Returning', and 'VIP'. The model you are using is a tree-based algorithm (e.g., XGBoost). Which encoding technique(s) would be most appropriate for this feature?
- A
One-hot encoding
- B
Label encoding
- C
Binary encoding
- D
Tokenization
Show answer and explanation
Correct answers: A, B
Explanation
Tree-based algorithms, such as XGBoost, can handle both one-hot encoding and label encoding effectively. One-hot encoding is commonly used for small sets of categorical values as it creates interpretable binary columns. Label encoding is also appropriate for tree-based models because the algorithm does not assume an ordinal relationship between encoded values. Binary encoding and tokenization are not suited for this specific scenario.
- A. Correct.
One-hot encoding is appropriate for tree-based algorithms as it creates separate binary columns for each category, allowing the model to effectively split on these features.
- B. Correct.
Label encoding is also appropriate for tree-based algorithms since the algorithm uses the order of the labels only to split data and does not assume a numerical relationship between the values.
- C. Incorrect.
Binary encoding is generally used for high-cardinality categorical features (features with a large number of unique values) to reduce dimensionality, which is not necessary in this case with only three categories.
- D. Incorrect.
Tokenization is used for text-based features, not for encoding categorical features, and is irrelevant in this scenario.