One-Hot Encoding
An encoding method that expands a discrete variable with k categories into k binary columns. It prevents category codes from being interpreted as numerical magnitudes and allows linear models to learn independent weights for each category.
Timeline (last 90 days)
One-Hot Encoding converts a categorical variable containing k categories into k binary features, each corresponding to one category, with a value of 1 when the sample belongs to that category and 0 otherwise.
Under one-hot encoding, directly computing leverage scores along the direction of greatest data variation (maximum variance) fails, because the indicator columns of frequent actions have large variance, so rare transitions cannot be identified.
Common feature engineering operations include missing value imputation, categorical feature encoding (such as one-hot encoding and target encoding), numerical feature standardization/normalization, binning, cross-feature combinations, and lag features and sliding window statistics for time series.
One-hot encoding produces a high-dimensional sparse matrix; when the cardinality of categories is very large, target encoding or embeddings should be used instead.
Module 3 of ML Zoomcamp 2026 covers logistic regression training, one-hot encoding for handling categorical variables, mutual information scoring, feature elimination, and the interpretability of classification models.
The students reran the comparison using another one-hot encoding scheme and confirmed that the 0.002 accuracy difference is real, not random error.
One-hot encoding expands a discrete variable containing k categories into k binary columns, with each sample taking 1 in the column for its corresponding category and 0 in the rest.
One-hot encoding has a dummy variable trap: if all k columns are kept while an intercept term is fitted, the features become perfectly collinear; although logistic regression can mitigate this through regularization, drop='first' is usually still used to remove one column.
The mathematical essence of one-hot encoding is mapping categorical variables onto standard orthonormal bases in Euclidean space, such that the Euclidean distance between any two different categories is equal (all equal to √2).
All Facts (10)
One-hot encoding produces a high-dimensional sparse matrix; when the cardinality of categories is very large, target encoding or embeddings should be used instead.
60%UnverifiedOne-Hot Encoding converts a categorical variable containing k categories into k binary features, each corresponding to one category, with a value of 1 when the sample belongs to that category and 0 otherwise.
50%UnverifiedUnder one-hot encoding, directly computing leverage scores along the direction of greatest data variation (maximum variance) fails, because the indicator columns of frequent actions have large variance, so rare transitions cannot be identified.
50%UnverifiedCommon feature engineering operations include missing value imputation, categorical feature encoding (such as one-hot encoding and target encoding), numerical feature standardization/normalization, binning, cross-feature combinations, and lag features and sliding window statistics for time series.
50%UnverifiedThe students reran the comparison using another one-hot encoding scheme and confirmed that the 0.002 accuracy difference is real, not random error.
50%UnverifiedOne-hot encoding expands a discrete variable containing k categories into k binary columns, with each sample taking 1 in the column for its corresponding category and 0 in the rest.
50%UnverifiedOne-hot encoding has a dummy variable trap: if all k columns are kept while an intercept term is fitted, the features become perfectly collinear; although logistic regression can mitigate this through regularization, drop='first' is usually still used to remove one column.
50%UnverifiedModule 3 of ML Zoomcamp 2026 covers logistic regression training, one-hot encoding for handling categorical variables, mutual information scoring, feature elimination, and the interpretability of classification models.
50%UnverifiedThe mathematical essence of one-hot encoding is mapping categorical variables onto standard orthonormal bases in Euclidean space, such that the Euclidean distance between any two different categories is equal (all equal to √2).
50%UnverifiedThere are multiple schemes for encoding board states, including a 9-dimensional vector (−1/0/1), 27-dimensional one-hot encoding, and a dual-channel binary matrix suitable for convolutional neural networks
50%