liveBook · Manning

Categorical encoding

As explained in The Art of AI Product Development

One-hot encoding represents each item in a categorical set as a vector with one active element and all other elements zero.

One-hot encoding turns each item in a categorical set into a numerical vector: one position is 1, and every other position is 0. This gives an AI model a simple way to distinguish categories, but it is a coarse representation that can discard useful information. section 3.1.1

Representing words

For a vocabulary of words, each word receives its own vector position. The vector identifies the word through its single active element, without expressing richer relationships between words. section 3.1.1

Figure 3.4 One-hot encoding provides a simple numerical (algebraic) representation of words.
A screenshot of a computer

AI-generated content may be incorrect.

Use the figure to inspect how one-hot encoding provides a simple algebraic representation of words. section 3.1.1

How The Art of AI Product Development covers it

How deep it goes
Defines the vector representation and its information loss, then defers richer word representations to word embeddings.
Examples
Uses words represented as zero vectors with one active element and illustrates the mapping in Figure 3.4.
What it assumes
Assumes that AI models require numerical inputs and treats preprocessing as the bridge from raw data to numbers.
What you can do after
Apply it to represent categorical items numerically while recognizing its coarse treatment of information.
How it connects
Connects preprocessing with natural language processing, numerical representations, and word embeddings.

Also explained in

Compare how 13 books explain categorical encoding →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Art of AI Product Development. The section links point to the parts of the book it draws on.