Question
A company wants to predict the success of advertising campaigns by considering the color scheme of each advertisement. An ML engineer is preparing data for a neural network model. The dataset includes color information as categorical data.
Which technique for feature engineering should the ML engineer use for the model?
- A. Apply label encoding to the color categories. Automatically assign each color a unique integer.
- B. Implement padding to ensure that all color feature vectors have the same length.
- C. Perform dimensionality reduction on the color categories.
- D. One-hot encode the color categories to transform the color scheme feature into a binary matrix. Correct
Explanation
One-hot encoding (Option D) is the correct technique for transforming categorical data like color schemes into a format that can be provided to machine learning algorithms. This method converts each category value into a new column and assigns a 1 or 0 (binary) value to the column, indicating the presence or absence of the category in the row. This approach avoids imposing an arbitrary ordering on categories as label encoding might do, which is crucial for categorical data without intrinsic order.