One-Hot Encoding
Table of Contents
The Problem
We are dealing with categories - Duck, Beaver, and Walrus - but our classifier works with numbers, what do we do?
One Solution
one-hot encoding, in this context, means taking each of our classifications and creating a column for it and putting a 1 in the row if it matches the column and a 0 otherwise.
Sighting | Duck | Beaver | Walrus |
---|---|---|---|
0 | 1 | 0 | 0 |
1 | 0 | 1 | 0 |
2 | 1 | 0 | 0 |
3 | 0 | 0 | 1 |
4 | 0 | 1 | 0 |