Skip to content
ML Academy

Introduced on day 9

Target encoding

Replacing each category with a (usually smoothed) statistic of the target for that category, such as its no-show rate.

In detail

Compact and strong for high-cardinality categories, but it leaks when a row's own outcome contributes to its encoding. Fit it after the split, cross-fitted on training folds, with shrinkage toward the global mean and a fallback for unseen categories.