Problem bank

Problem 162 of 333HardStatisticsP162

Encoding high-cardinality categoricals without leakage

  1. You want to use 'ticker symbol' as a feature in a cross-sectional returns model. There are 3000 tickers and you don't want to one-hot encode. You consider target encoding: replace ticker with the mean return of that ticker historically. What's the danger and how do you fix it?