# One-Hot Encoding

## 22.12.2020 | Processing/Encoding

### Contents/Index

@1. One-Hot Encoding

One hot encoding a collection of elements $\mathcal{X}$ is done by encoding each $x \in \mathcal{X}$ by a vector of size $|\mathcal{X}|$. The encoding vector is a 1 placed in a distinct location and 0 elsewhere. For example for $\mathcal{X} = \{apple,orange,banana\}$ we can one hot encode as $$apple = [1,0,0]$$ $$orange = [0,1,0]$$ $$banana = [0,0,1]$$

The downside of one hot encoding is that we can't compute similarities.