Expand description
Target encoder: encode categorical features using target statistics.
TargetEncoder replaces each category with the mean of the target variable
for that category, regularised toward the global mean using smoothing.
This is especially useful for high-cardinality categorical features where one-hot encoding would produce too many columns.
§Smoothing
The encoded value for category c is:
encoded(c) = (count(c) * mean_c + smooth * global_mean) / (count(c) + smooth)where smooth controls the degree of regularisation.
Structs§
- Fitted
Target Encoder - A fitted target encoder holding per-feature, per-category encoding values.
- Target
Encoder - An unfitted target encoder.