MLA-C01 Question 62
Single answerYou are building a machine learning model to predict customer churn for a subscription service. Your dataset includes a categorical feature called 'Subscription Type' with three possible values: 'Basic', 'Premium', and 'Enterprise'. The model you are using is a tree-based algorithm that does not require feature scaling. Which encoding technique is the most appropriate to use for this feature?
- A
Label Encoding
- B
One-Hot Encoding
- C
Binary Encoding
- D
Tokenization
Show answer and explanation
Correct answer: B
Explanation
Tree-based algorithms, such as Random Forest or XGBoost, do not require feature scaling and can handle categorical data well. However, using Label Encoding could introduce unintended ordinal relationships between the categories. One-Hot Encoding is the most appropriate choice because it avoids ordinal relationships and creates binary columns for each category, ensuring that the tree-based model can process the data effectively.
- A. Incorrect.
Label Encoding assigns a unique integer to each category (e.g., Basic=0, Premium=1, Enterprise=2). However, this can introduce unintended ordinal relationships, which tree-based models generally do not handle correctly.
- B. Correct.
One-Hot Encoding creates a separate binary column for each category without introducing ordinal relationships. This is the most appropriate technique for tree-based models when dealing with categorical features.
- C. Incorrect.
Binary Encoding converts categories into binary digits, which reduces dimensionality compared to One-Hot Encoding. However, it may still introduce slight ordinal relationships, making it less ideal for this scenario.
- D. Incorrect.
Tokenization is used to process text data by splitting it into tokens (e.g., words or subwords). It is not suitable for encoding categorical variables like 'Subscription Type'.