Jargonautica
Classical Machine Learning

One-hot Encoding

Turning a category into numbers without accidentally implying an order. If you number colours red as one, blue as two, green as three, a model will think green is somehow more than red. One-hot encoding gives each category its own yes-or-no column instead.

Technical view

Produces a sparse binary column per category, exploding dimensionality for high-cardinality features. Alternatives include target encoding, which risks leakage unless computed within cross-validation folds, hashing for very large vocabularies, and learned embeddings, which are the neural generalisation. Tree models handle categorical splits natively in some implementations, avoiding the expansion entirely.


Part of AI Terminology Index, section: Classical Machine Learning.

How it connects

One-hot Encoding links to 4 other terms. The faint lines are links between those terms. See it in the full graph.

Feature EngineeringFeature EngineeringData LeakageData LeakageDecision TreeDecision TreeEmbedding LayerEmbedding LayerOne-hot Encoding