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 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 students reran the comparison using another one-hot encoding scheme and confirmed that the 0.002 accuracy difference is real, not random error.
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.
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 produces a high-dimensional sparse matrix; when the cardinality of categories is very large, target encoding or embeddings should be used instead.
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).
棋盘状态编码有多种方案,包括9维向量(-1/0/1)、27维独热编码、以及适合卷积神经网络的双通道二值矩阵
All Facts (7)
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.
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%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%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 produces a high-dimensional sparse matrix; when the cardinality of categories is very large, target encoding or embeddings should be used instead.
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%Unverified棋盘状态编码有多种方案,包括9维向量(-1/0/1)、27维独热编码、以及适合卷积神经网络的双通道二值矩阵
50%