Which feature did the model use
After fitting, you want to know which features the model relies on, to check it makes sense and to drop dead weight. Tree models report an impurity importance: the total split gain each feature produced, divided by the sum over features. It is free to compute but biased toward features with many distinct values, and it is measured on training data, so a noise feature can look important. Permutation importance is more honest. Take a fitted model and a held-out set, shuffle one feature's values, which breaks its link with the target, and record how much the score drops: . Repeat the shuffle several times and average.
Two cautions. First, correlated features share credit: if two columns carry the same information, shuffling one leaves the other to do the work, and both look unimportant. Group such features or drop one. Second, importance describes the model, not the world. A feature that matters to a bad model does not make it a cause of returns. With cross-sectional data, shuffle the feature within each month, so the shuffle keeps the month's level and only breaks the ranking among stocks. Report the spread over the repeats as well, because a small importance with a larger spread is noise.
- Shuffle and score: importance is how much the held-out score falls when one feature is shuffled.
- Correlated twins hide each other: group them or drop one before you read the numbers.
- Importance is about the model: it is a check, not proof that a feature causes returns.
Lab · what's graded
- The mean of the shuffles10 pts
- The permutation importance15 pts
- The spread of the repeats15 pts
- An impurity share10 pts
- A twin feature10 pts
- Which importance to trust10 pts
- The permutation procedure10 pts
- Important to the model, not to returns20 pts