What does one-hot encoding fundamentally accomplish when applied to a categorical feature?
Select an answer to reveal the explanation.
Short Explanation and Infographic
One-hot encoding takes a category — say, 'red,' 'blue,' or 'green' — and turns it into a vector of 0s and 1s, where exactly one position is 'hot' (a 1) and everything else is 0. Each category gets its own dedicated position, so 'red' might be [1,0,0], 'blue' [0,1,0], and so on. That binary vector representation, with one active spot per category, is exactly what one-hot encoding accomplishes — that's your answer. It doesn't reduce or group categories together — that would be a totally different technique aimed at cutting dimensionality. It doesn't scale anything into a continuous range either — the output is strictly binary, not a smooth number line. And it has nothing to do with removing duplicate rows — that's a data-cleaning operation, unrelated to how a single category gets represented numerically.
Full explanation below image
Full Explanation
One-hot encoding is a technique for converting a categorical variable into a numeric format suitable for machine learning models, particularly neural networks, which require numeric input. For a feature with N distinct categories, each category is represented as a binary vector of length N, where exactly one element is 1 (the 'hot' position corresponding to that category) and all other elements are 0. For example, a three-category feature like {red, blue, green} would be encoded as red = [1, 0, 0], blue = [0, 1, 0], and green = [0, 0, 1]. This representation avoids implying any ordinal relationship or numeric distance between categories, since each category is equidistant from every other in the resulting vector space, which is appropriate for nominal (unordered) categorical data.
Reducing the number of categories by grouping similar ones together describes a dimensionality-reduction or feature-engineering technique sometimes applied before encoding (for example, combining rare categories into an 'other' bucket), but it is a separate preprocessing decision from what one-hot encoding itself does. One-hot encoding does not perform any grouping; it simply represents whatever categories already exist as binary vectors.
Scaling categorical values into a continuous range between 0 and 1 describes normalization techniques like min-max scaling, which apply to continuous numeric features, not categorical ones. One-hot encoding produces strictly binary (0 or 1) values, not a smooth continuous range, and is not a scaling operation in the numeric sense.
Removing duplicate rows that share the same category value describes a data deduplication step, entirely unrelated to encoding. One-hot encoding operates on the representation of category values themselves and has no role in identifying or removing duplicate records in a dataset.
Memory aid: one-hot encoding answers the question 'which category is this?' with a vector that has a single 1 marking the answer and 0s everywhere else — useful for unordered categories, though it can become inefficient (very sparse, high-dimensional) when the number of categories grows very large, at which point embeddings are often preferred.