A team encodes the categorical variable 'state' (50 categories) by replacing each state with the average default rate computed on training data. What encoding method is this, and what is its primary risk?
Select an answer to reveal the explanation.
Short Explanation
Here's the deal — target encoding replaces each state with the mean default rate from training data, and if you compute those means across the full dataset instead of inside each cross-validation fold, you leak target information. You're not using binary indicators, arbitrary integers, or category counts.
Full Explanation
Target encoding (mean encoding) is correct because it replaces each state with the average default rate from training data. Its primary risk is target leakage if those means are computed on the full dataset or include the current/validation fold instead of only the training portion of each CV fold. One-hot encoding is wrong because it creates binary indicators and risks high dimensionality, not target means. Label encoding is wrong because it assigns arbitrary integers and risks ordinal relationships. Frequency encoding is wrong because it uses category counts, not mean target values.