MLA-C01 Question 42
Select 3You are building a machine learning model using Amazon SageMaker. Your dataset contains a 'Date' column in the format 'YYYY-MM-DD'. To improve model performance, you decide to transform this column into additional features. Which of the following feature engineering steps are appropriate for this scenario?
- A
Extract the year, month, and day as separate numerical features.
- B
Convert the 'Date' column into a single categorical feature representing the day of the week.
- C
Drop the 'Date' column entirely since it is not a numerical feature.
- D
Apply one-hot encoding to the extracted month feature.
- E
Normalize the 'Date' column using min-max scaling.
Show answer and explanation
Correct answers: A, B, D
Explanation
In machine learning, date-based features can provide valuable information about temporal patterns. Extracting components like year, month, and day allows the model to learn from these individual attributes. Converting the date into categorical representations, such as the day of the week, can reveal trends like weekly cycles. Additionally, one-hot encoding on features like months prevents ordinal bias and enables the model to better interpret the data. Dropping the 'Date' column or applying inappropriate transformations, like min-max scaling, can result in loss of information or misrepresentation of the data.
- A. Correct.
Extracting the year, month, and day as separate numerical features is a common and effective feature engineering step for date-related data, as it allows the model to learn patterns based on these components.
- B. Correct.
Converting the 'Date' column into a categorical feature representing the day of the week can capture temporal patterns like weekly trends, which may be useful for the model.
- C. Incorrect.
Dropping the 'Date' column entirely is not recommended unless it has been determined to have no predictive value. In this case, the 'Date' column contains useful temporal information.
- D. Correct.
Applying one-hot encoding to the extracted month feature is appropriate for categorical features like months, as it helps the model understand seasonal patterns without introducing ordinal bias.
- E. Incorrect.
Normalizing the 'Date' column using min-max scaling is not appropriate because the 'Date' column is not a continuous numerical feature. Min-max scaling is better suited for numerical data with meaningful magnitude.