Categorical Features, Exactly
Pin a training category list, expand discrete codes into one-hot matrices, lock column order, route unseen categories to Other, and compare group means against false numeric order.
Exact One-Hot Categorical Encoding
Pin training vocabularies, build one-hot rows and tables, preserve column order, handle unknown categories, and fit exact group means.
- Pin the Category List
freeze the ordered category vocabulary and count training occurrences
- One Row Becomes One-Hot
expand one categorical value into a binary one-hot indicator vector
- Encode the Shown Table
broadcast a column of category IDs into a full N-by-K one-hot matrix
- Column Order Is Part of the Data
preserve pinned column order so learned category weights hit the right slots
- Unknown Category Goes to Other
route out-of-vocabulary category codes into a dedicated Other column
- What Encoding Is and Is Not
fit exact per-category group means and see both the power and limits of one-hot encoding