MLS-C01 Question 71
Select 3You are working on a machine learning project to predict customer churn using AWS services. The raw dataset contains missing values, categorical variables, and outliers. You need to sanitize and prepare the data for modeling. Which of the following steps should you take to ensure the dataset is ready for training your model?
- A
Impute missing values using appropriate statistical measures or algorithms.
- B
Normalize numerical features to ensure all values fall within a similar scale.
- C
Randomly remove rows with missing values to reduce dataset size.
- D
Encode categorical variables into numerical format using techniques like one-hot encoding.
- E
Retain outliers in the dataset to preserve variability and model robustness.
Show answer and explanation
Correct answers: A, B, D
Explanation
To prepare data for modeling, it is essential to handle missing values, normalize numerical features, and encode categorical variables to ensure the dataset is clean and suitable for machine learning algorithms. Randomly removing rows with missing values can cause data loss, and retaining outliers without addressing them can negatively impact the model's performance. Proper data sanitization improves the model's ability to learn and generalize effectively.
- A. Correct.
Imputing missing values is a crucial step in data preparation. Techniques such as mean, median, mode imputation, or using algorithms like KNN can help fill in these gaps, ensuring the dataset is complete for training.
- B. Correct.
Normalization of numerical features ensures that all features contribute equally to the model and prevents features with larger magnitudes from dominating the model's learning process.
- C. Incorrect.
Randomly removing rows with missing values can lead to data loss and biases, especially if the missing data is not missing completely at random. This is not considered a best practice.
- D. Correct.
Encoding categorical variables into numerical format is necessary for most machine learning algorithms, as they cannot directly handle non-numerical data. Techniques like one-hot encoding or label encoding are common approaches.
- E. Incorrect.
Outliers can skew the model's predictions and lead to poor generalization. It is often necessary to detect and handle outliers, rather than retaining them without consideration.