AI engineering glossary · Feature engineering data prep

What is binary encoding?

Binary encoding: Encoding categories by first assigning each an integer, then writing that integer in binary and splitting its digits across columns. It needs only about log2(k) columns for k categories, a compromise between label and one-hot encoding for high-cardinality features.

Level: intermediateTopic: Feature engineering data prep

Binary encoding: an example

With 100 categories, binary encoding needs 7 columns, since 2^7 = 128, instead of 100 one-hot columns.

Related terms

More Feature engineering data prep terms

Where you learn it

Binary encoding is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.