MLS-C01 Question 78
Select 2You are working on training a machine learning model using an AWS SageMaker pipeline. The input dataset contains numerical features in different ranges, categorical features encoded as strings, and significant class imbalance. Which of the following steps should you take to ensure optimal model performance during preprocessing?
- A
Normalize the numerical features to a common scale, such as between 0 and 1 or using z-score normalization.
- B
Perform one-hot encoding for the categorical features to convert them into numerical format.
- C
Downsample the majority class to fully balance the class distribution.
- D
Use data augmentation techniques like flipping or rotation to increase the dataset size.
- E
Apply feature scaling only to the numerical features that have low variance.
Show answer and explanation
Correct answers: A, B
Explanation
To prepare a dataset for training in a machine learning pipeline, it's important to normalize numerical features and encode categorical features appropriately. This ensures that features contribute equally to the model's learning process and enables the model to interpret categorical data effectively. While addressing class imbalance and other considerations may be important, the options for balancing and augmentation provided here are not optimal for this dataset type.
- A. Correct.
Correct: Normalizing numerical features ensures that features with different ranges do not disproportionately influence the model during training.
- B. Correct.
Correct: Machine learning models generally require categorical data to be converted into numeric representations. One-hot encoding is a common and effective method to achieve this.
- C. Incorrect.
Incorrect: Downsampling the majority class can address class imbalance, but fully balancing the dataset by downsampling can result in loss of valuable data and is not always recommended.
- D. Incorrect.
Incorrect: Data augmentation techniques like flipping or rotation are typically used for image data, not for structured datasets like the one described in this scenario.
- E. Incorrect.
Incorrect: Feature scaling should be applied to all numerical features regardless of their variance to ensure consistent treatment of data values.