MLS-C01 Question 94
Select 2You are building a machine learning model to predict customer churn for a subscription-based service. The dataset contains features such as 'Age', 'Tenure', 'Monthly Charges', and 'Contract Type'. You notice that the 'Contract Type' feature is categorical with three possible values: 'Month-to-Month', 'One-Year', and 'Two-Year'. Which of the following feature engineering techniques should you apply to prepare the 'Contract Type' feature for a machine learning model?
- A
Apply one-hot encoding to the 'Contract Type' feature.
- B
Normalize the 'Contract Type' feature to scale values between 0 and 1.
- C
Perform label encoding on the 'Contract Type' feature.
- D
Remove the 'Contract Type' feature since it is categorical.
- E
Group 'One-Year' and 'Two-Year' into a single category to reduce dimensionality.
Show answer and explanation
Correct answers: A, C
Explanation
To prepare a categorical feature like 'Contract Type' for a machine learning model, you can either use one-hot encoding (to avoid implying an ordinal relationship) or label encoding (to assign unique integer values to categories). These techniques ensure the categorical data is appropriately represented in a numerical format for the model. Normalization, feature removal, or arbitrary grouping are not suitable for this use case.
- A. Correct.
Correct: One-hot encoding is a common technique to handle categorical data by creating binary columns for each category, which avoids introducing ordinal relationships.
- B. Incorrect.
Incorrect: Normalization is typically applied to numerical features, not categorical features like 'Contract Type'.
- C. Correct.
Correct: Label encoding can be used to convert categorical labels into numerical values, which is useful for certain types of machine learning models.
- D. Incorrect.
Incorrect: Removing the 'Contract Type' feature would result in losing potentially important information, which is not ideal unless there is evidence it lacks predictive power.
- E. Incorrect.
Incorrect: Grouping categories without domain knowledge or justification might lead to a loss of important distinctions between categories.