Turning Categories into Numbers

Numbering categories such as dog, cat and rabbit 1, 2 and 3 invents an order and distances that aren't there, so one-hot encoding gives each category a column of its own, which OneHotEncoder learns from the training data, with handle_unknown='ignore' for a category it never saw, while OrdinalEncoder fits categories that really have an order, given in that order.

By

Updated

Cheat sheet: Turning Categories into Numbers
Category
Machine Learning
Level
Journeyman
Tags
ai, Categorical Feature, One-Hot Encoding, OneHotEncoder, OrdinalEncoder, python