BIZNIQUE / LINEAR ALGEBRA / 26
Make category encoding interpretable
Choose a representation whose arithmetic matches what the categories mean.
BIZNIQUE / LINEAR ALGEBRA / 26
Choose a representation whose arithmetic matches what the categories mean.
THE IDEA
One-hot encoding allocates an indicator to each category. It avoids imposing a numerical order on unrelated labels. In a regression with an intercept, dropping one category can provide a reference against which other category effects are interpreted.
One-hot category → one active indicator
The numbers 1, 2 and 3 imply distances if treated as numeric inputs. Those distances are not justified merely because the categories need identifiers.
TRY IT YOURSELF
Does assigning red = 1 and blue = 2 establish that blue is twice as much as red?
No. The numbers identify categories; they do not define a meaningful ratio.