| Animal | mean_kg | |
|---|---|---|
| cat | → | 4.1 |
| dog | → | 15.4 |
| rabbit | → | 2.2 |
| Animal | A_0 | A_1 | A_2 | ... | A_16 | |
|---|---|---|---|---|---|---|
| cat | → | 1 | 0 | 0 | ... | 1 |
| dog | → | 0 | 1 | 0 | ... | 1 |
| rabbit | → | 1 | 0 | 1 | ... | 0 |
Even fancier methods exist, like supervised encoding methods which basically train a model-within-a-model

Drawbacks - Only useful for naturally ordered data - Assumes linear relationship - Difficult to deal with novel features
Drawbacks - Not good for high cardinality -> consider feature hashing or combining categories - Collinearity issues -> (if a concern for model) dummy encoding instead with drop - Novel features -> implied by 0 if not using dummy, could also define "other" category
Drawbacks - Doesn't work for unsupervised - Loss of relationship with other features - Mean is not great for categories with few examples