One-Hot Encoding Ad Campaign Color Schemes for a Neural Network Without Implying Order
Short answer
D One-hot encoding turns the color scheme into a binary matrix with one column per color, so the network sees independent categories, not a false order.
Question
Key Takeaways
One-hot encoding gives each color its own binary column, so the network sees independent category indicators rather than integers that imply blue is somehow larger than red. Label encoding would fabricate an ordinal relationship that does not exist in color.
An ML engineer is preparing categorical color-scheme data for a neural network that predicts advertising campaign success. Colors are nominal categories with no inherent order or magnitude, and neural networks require numeric input, so the encoding must convert categories to numbers without inventing a false ranking.
Common mistake: Applying label encoding so each color gets a unique integer, which makes the network treat the integers as ordered quantities. Padding is for sequence data, and dimensionality reduction is for compressing high-dimensional numeric features, so both are irrelevant to nominal categories.
Expert Analysis
Why the Answer Is Correct
The color scheme is nominal categorical data: the colors have no natural order and no meaningful distance between them, yet a neural network can only consume numbers. One-hot encoding solves this by creating a separate binary column per color, so with three colors you get three columns where exactly one is 1, and the network receives independent presence indicators with no implied ranking. That is exactly the correct feature engineering treatment for nominal categories feeding a neural network. The vote was unanimous at 100 for D. GiorgioGss worked through a concrete red, blue, green example showing the three resulting binary vectors and explained that this lets the model use the color feature without assuming ordinal relationships, and Sadrik made the same point from the opposite direction.Why the Other Options Are Wrong
Applying label encoding so each color is assigned a unique integer (A) is actively harmful here, because integers carry magnitude and order; the network would effectively be told that one color is larger or more important than another based on its arbitrary code, a false relationship the model would then learn. Implementing padding so all color feature vectors have the same length (B) is a sequence-data technique for making variable-length inputs uniform, and color categories are not sequences, so there is nothing to pad. Performing dimensionality reduction on the color categories (C) is a technique for compressing a large number of numeric features into fewer dimensions, and applying it to a small set of nominal categories both destroys information and solves a problem that does not exist here.Community Comment Notes
The community was unanimous at 100 for D and every substance comment agreed. Saransundar provided the cleanest mapping of technique to data type, associating label encoding with ordinal relationships, padding with sequence data, dimensionality reduction with high-dimensional data, and one-hot encoding with categorical data. GiorgioGss and Sadrik supplied the two complementary justifications: one showing the binary matrix that one-hot encoding produces, the other warning that label encoding makes the model assume a numerical relationship between colors that does not exist. Sid4ops summarized the rule of thumb that categorical data calls for one-hot encoding.Official Reference
https://docs.aws.amazon.com/glue/latest/dg/what-is-glue.html
This link opens the official vendor documentation in a new tab.
Community Votes
100% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 4 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 4
-
Saransundar 👍 7 Answered D1. Label Encoding: Ordinal relationship 2. Padding: Sequence data 3. Dimensionality Reduction: High-dimensional data 4. One-Hot Encoding: Categorical data (Right)
-
GiorgioGss 👍 2 Answered DOne-hot encoding creates a new binary feature for each unique category (color in this case). For example, if there are three colors (red, blue, green), one-hot encoding would create three binary columns like this: Red: [1, 0, 0] Blue: [0, 1, 0] Green: [0, 0, 1] this way, the model can work with the color feature without assuming ordinal relationships between colors.
-
Sadrik 👍 1 Answered DLabel encoding is not ideal for categorical data in neural networks because the model might assume a numerical relationship (e.g., Blue is twice more important than Red), which is incorrect.
-
Sid4ops 👍 1 Answered DCategorical data one hot always
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All MLA-C01 Questions
Access 115 questions with complete answers and detailed explanations.
View Full MLA-C01 Practice Test →