An ML engineer is preparing input for a neural network to predict advertising campaign success. The dataset includes the advertisement’s color scheme as a categorical feature. Which feature-engineering method should the engineer use for this categorical color data?
Choose an answer
Tap an option to check your answer.
Correct answer: One-hot encode the color categories so the color-scheme feature becomes a binary matrix..
Why this is the answer
One-hot encoding is the most appropriate method for categorical features like color schemes in neural networks. It converts each category into a binary vector, where a '1' indicates the presence of that category and '0's elsewhere. This prevents the neural network from inferring an ordinal relationship between categories, which would be incorrect for colors (e.g., red is not "greater" than blue). Label encoding assigns a unique integer to each category. While simple, it introduces an artificial ordinal relationship (e.g., 1 for red, 2 for blue, 3 for green) that can mislead the model into believing some colors are "higher" or "lower" than others, which is not true for nominal data. Padding is used for sequence data to ensure uniform length, not for encoding categorical features. Dimensionality reduction is applied to reduce the number of features, typically after initial encoding, not as a primary encoding method for nominal categories.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed