MLS-C01 Question 53
Select 4You are tasked with building a machine learning model to predict customer churn for an e-commerce platform. The raw dataset contains several categorical features such as 'PaymentMethod', 'SubscriptionPlan', and 'Region', along with numerical features like 'MonthlySpending' and 'Tenure'. Before training the model, you decide to preprocess the data using AWS Glue. Which of the following transformations should you implement to ensure the dataset is ready for training?
- A
Apply one-hot encoding to the categorical features like 'PaymentMethod' and 'Region'.
- B
Normalize numerical features such as 'MonthlySpending' and 'Tenure' to a range between 0 and 1.
- C
Combine all categorical features into a single column to reduce dimensionality.
- D
Handle missing values in the dataset by filling them with the mean for numerical features and the mode for categorical features.
- E
Generate synthetic features by multiplying 'MonthlySpending' with 'Tenure' to capture interaction effects.
Show answer and explanation
Correct answers: A, B, D, E
Explanation
Data preprocessing is a crucial step in machine learning workflows, especially in AWS Glue, where you can implement key transformations. One-hot encoding categorical data ensures compatibility with machine learning algorithms, while normalizing numerical data ensures consistent scaling across features. Handling missing values ensures no gaps impact model performance, and generating synthetic features can reveal hidden patterns. However, combining all categorical features into one column is not a meaningful transformation and would lead to loss of critical information.
- A. Correct.
One-hot encoding is appropriate for categorical features to represent them as binary vectors, making them suitable for machine learning models.
- B. Correct.
Normalization is essential for numerical features to ensure they are scaled consistently, especially for models sensitive to feature magnitude.
- C. Incorrect.
Combining all categorical features into a single column is not a valid transformation and can lead to loss of information.
- D. Correct.
Handling missing values is critical for maintaining the quality of the dataset and preventing errors during model training.
- E. Correct.
Feature engineering, such as generating synthetic features, can help capture important interactions and improve model performance.