Encoding categorical variables without creating leakage

11295
0

Categoricals are where good intentions become leakage. I use one-hot encoding for low-cardinality stable fields, ordinal encoders only when order is real, and frequency or target encoders with strict cross-validation boundaries. The encoder strategy should reflect both statistical behavior and production serving constraints.