MLA-C01 · Question #26
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
The correct answer is D. One-hot encode the color categories to transform the color scheme feature into a binary matrix.. One-hot encoding (D) is correct because neural networks require numerical input, and color categories have no inherent ordinal relationship - one-hot encoding represents each color as a binary vector (e.g., Red = [1,0,0], Blue = [0,1,0]) without implying any false ordering or mag
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?
Options
- AApply label encoding to the color categories. Automatically assign each color a unique integer.
- BImplement padding to ensure that all color feature vectors have the same length.
- CPerform dimensionality reduction on the color categories.
- DOne-hot encode the color categories to transform the color scheme feature into a binary matrix.
How the community answered
(23 responses)- A4% (1)
- B4% (1)
- D91% (21)
Explanation
One-hot encoding (D) is correct because neural networks require numerical input, and color categories have no inherent ordinal relationship - one-hot encoding represents each color as a binary vector (e.g., Red = [1,0,0], Blue = [0,1,0]) without implying any false ordering or magnitude between colors.
Why the distractors are wrong:
- A (Label encoding) assigns integers like 1, 2, 3 to colors, which falsely implies an ordering (e.g., "Red < Blue < Green"), causing the model to learn spurious relationships that don't exist.
- B (Padding) is used to standardize sequence lengths in text or time-series data, not to handle categorical features - it's the wrong tool for this problem.
- C (Dimensionality reduction) techniques like PCA are applied after encoding to compress already-numerical features, not as a primary encoding strategy for raw categorical data.
Memory tip: Think of one-hot encoding as giving each category its own "spotlight" - only one light is on at a time, with no category ranked higher than another. Whenever you see unordered categorical data going into a neural network, one-hot encoding is your default choice.
Topics
Community Discussion
No community discussion yet for this question.