MLS-C01 Question 70
Select 3You are working on a machine learning project to predict customer churn for an e-commerce company. The dataset contains customer demographic details, purchase history, and website interaction logs. During data exploration, you notice that the 'Age' column has several missing values, the 'Purchase_Amount' column has extreme outliers, and the 'Gender' column is stored as categorical text values ('Male', 'Female'). Which steps should you take to sanitize and prepare the data for modeling?
- A
Impute the missing values in the 'Age' column using an appropriate statistical method such as mean or median.
- B
Remove the rows with missing values in the 'Age' column to ensure a clean dataset.
- C
Normalize the 'Purchase_Amount' column to handle extreme outliers.
- D
Convert the 'Gender' column into numerical format using one-hot encoding or label encoding.
- E
Delete the 'Gender' column as it is a categorical feature and cannot be used in machine learning models.
Show answer and explanation
Correct answers: A, C, D
Explanation
Data sanitization and preparation involve handling missing values, outliers, and categorical features appropriately to ensure the dataset is suitable for machine learning models. Imputation is a common strategy for missing data, normalization addresses outliers, and categorical features should be encoded into numerical formats. Removing rows with missing values or deleting useful features unnecessarily can lead to loss of valuable information.
- A. Correct.
Imputing missing values using methods like mean or median is a common data preparation step to handle missing data without losing potentially valuable information.
- B. Incorrect.
Removing rows with missing values can lead to data loss and is not always the best approach unless the proportion of missing data is very high. In this case, imputing is a better choice.
- C. Correct.
Normalizing or transforming the 'Purchase_Amount' column can help mitigate the effect of extreme outliers on the model's performance.
- D. Correct.
Converting categorical features, such as 'Gender', into numerical formats is essential for most machine learning algorithms to process the data effectively.
- E. Incorrect.
Deleting the 'Gender' column is not advisable since it could be a valuable feature for predicting customer churn. Categorical features can be effectively processed using encoding methods.