Feature importance
Feature importance is a set of scores showing how much each input variable contributes to a machine learning model's predictions or to its accuracy.
A model that predicts house prices might use size, age and style as inputs, which machine learning calls features. Feature importance scores say which of those inputs the model leans on most. Google's machine learning glossary gives an example in which a decision tree scores size at 5.8, style at 4.7 and age at 2.5, so size matters most to that model. The scores describe the model, not the housing market.
There are several ways to compute them, and they answer slightly different questions. Tree-based models such as random forests offer impurity-based importance, which adds up how much each feature improved the splits during training. Permutation importance, which traces back to Leo Breiman's 2001 paper on random forests, works with any model: shuffle one feature's values so they no longer line up with the right answers, then measure how much the model's score drops. A large drop means the model relied on that feature. A third family explains single predictions. SHAP, introduced by Scott Lundberg and Su-In Lee in 2017, assigns each feature a share of the credit for one particular prediction, based on Shapley values from game theory.
Each method has traps. The scikit-learn documentation warns that impurity-based importance is strongly biased towards features with many distinct values and is computed on training data, so it can reward features the model has overfitted to. Permutation importance is better computed on held-out data. When two features are highly correlated, shuffling one barely hurts because the model can read the same information from the other, so both can look unimportant even when the information they share is vital. And a feature that seems useless to a poor model may matter a great deal to a good one.
Importance is not causation. If a loan model ranks postcode highly, that shows the model depends on postcode; it does not show that postcode causes default, and it may mean postcode is standing in for something else, such as income or ethnicity. That is exactly why the scores are useful for auditing. A feature that is suspiciously important, such as a hospital record number in a diagnosis model, is often the first sign of data leakage.
In practice, feature importance is a standard step in building models on tables of data: it guides which features to keep, helps explain a model to regulators and customers, and catches mistakes. Treat the numbers as a description of one trained model, computed by one method, and check them against a second method before drawing strong conclusions.
It is a score for each input feature that indicates how much the model relies on it, either to make its predictions or to achieve its accuracy. Higher scores mean the model's output depends more on that feature. Impurity-based importance comes from tree models and measures how much each feature improved the tree's splits during training. Permutation importance works with any model and measures how much performance falls when a feature's values are shuffled. Permutation importance on held-out data avoids the bias of impurity-based scores towards features with many distinct values. No. It shows what a particular model relies on, which can include proxies and coincidental patterns in the training data. Establishing that a feature causes an outcome needs experiments or causal analysis, not importance scores. SHAP, short for SHapley Additive exPlanations, is a method published in 2017 that splits a single prediction into contributions from each feature, using Shapley values from cooperative game theory. Averaging SHAP values across many predictions gives a global view of feature importance.Common questions
What is feature importance in machine learning?
What is the difference between permutation importance and impurity-based importance?
Does feature importance show cause and effect?
What are SHAP values?
Search for "permutation feature importance", "SHAP values" or "feature importance correlated features" to learn the methods and their pitfalls. The most dependable sources are the documentation of established libraries such as scikit-learn, the original papers on arXiv and in journals, and interpretability textbooks that compare methods side by side. Be cautious with blog posts that present a single bar chart of importances as an explanation of how the world works.Finding more
Working out what this means for your business?
Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.