MLS-C01 Question 74
Select 3You are developing a machine learning model to predict customer churn using a dataset stored in Amazon S3. During data preprocessing, you notice that several columns contain missing values, and the text data includes irrelevant common words (e.g., 'and', 'the', 'is'). What steps should you take to handle these issues effectively while preparing your data for training?
- A
Impute missing values using statistical techniques such as mean or median for numerical columns.
- B
Drop all rows containing missing values to ensure data integrity.
- C
Replace missing values in categorical columns with placeholders such as 'Unknown' or the mode.
- D
Use Natural Language Processing (NLP) techniques to remove stop words like 'and', 'the', 'is' from text data.
- E
Leave the missing values as is, as most ML algorithms can handle them during training.
Show answer and explanation
Correct answers: A, C, D
Explanation
Handling missing data and stop words are critical steps in preprocessing for machine learning. Imputing missing values for numerical and categorical columns ensures the dataset remains complete and usable. Removing stop words from text data reduces noise and improves feature quality for NLP models. Dropping rows with missing values or leaving them unhandled can lead to suboptimal model performance or errors during training.
- A. Correct.
Imputing missing values using mean or median is a common and effective approach for numerical columns to avoid data loss and ensure that the dataset remains usable for training.
- B. Incorrect.
Dropping all rows containing missing values can lead to significant data loss, especially if missing values are widespread. This is generally not recommended unless the missing data is minimal.
- C. Correct.
Replacing missing values in categorical columns with placeholders like 'Unknown' or the mode is a valid technique to handle missing data without discarding rows.
- D. Correct.
Removing stop words using NLP methods is a standard preprocessing step for text data to improve model performance by reducing noise.
- E. Incorrect.
Leaving missing values unhandled is not recommended because most ML algorithms do not handle missing values natively and may fail or produce inaccurate results.