Feature Importance Explainer
Model how feature importance is distributed across a machine learning model from feature count, average correlation and sample size, with a stability.
Feature Importance Explainer
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser โ no data is sent to any server.
Formula: Importance_i = (correlation_decay^i + (1 - correlation) / n) / sum_all
Worked example โ Top feature importance: 38.4% | Min features for 95% of target variance: 6 | Stability: 100%
Formula
Importance_i = (correlation_decay^i + (1 - correlation) / n) / sum_all
Feature importance is modeled using an exponential decay weighted by the average correlation strength. Higher correlation concentrates importance in fewer features, while lower correlation distributes it more evenly. The stability score estimates reliability based on the samples-per-feature ratio.
Worked Examples
Example 1: E-commerce Purchase Prediction
Problem:A model uses 8 features to predict purchase probability. The top feature (time on site) has correlation 0.82 with the target. Dataset has 5,000 samples. What is the importance distribution?
Solution:With high correlation (0.82), importance follows a steep distribution. Using the exponential decay 0.6^i: Feature 1 = 38.4%, Feature 2 = 23.4%, Feature 3 = 14.5%. Cumulative top-3 is 76.3% of total importance. With 5000/8 = 625 samples per feature, stability saturates the 100% ceiling. Features needed to reach 95% of the 85% variance target: 6 of 8.
Result:Top feature importance: 38.4% | Min features for 95% of target variance: 6 | Stability: 100%
Example 2: Medical Diagnosis with Many Features
Problem:A clinical model has 50 features with moderate average correlation (0.45) and 2,000 patient records. How should features be prioritized?
Solution:With moderate correlation (0.45), importance spreads further down the ranking. Top feature captures 27.5%, second 16.8%, third 10.3%. With 2000/50 = 40 samples per feature, the raw ratio exceeds the 30-per-feature floor, so stability is reported at its 100% ceiling. Normalized entropy is 73.2%, indicating importance is spread rather than concentrated. Reaching 95% of the 85% variance target still takes 43 of the 50 features. Consider dimensionality reduction (PCA) or L1 regularization to select a subset.
Result:Top feature: 27.5% | Normalized entropy: 73.2% | Min features for 95% of target variance: 43 | Stability: 100%
Frequently Asked Questions
What is feature importance in machine learning?
Feature importance measures how much each input variable (feature) contributes to a model prediction. It helps data scientists understand which variables drive outcomes and which can be safely removed. Common methods include permutation importance (shuffling a feature and measuring accuracy drop), Gini importance (used in tree-based models measuring impurity reduction), and SHAP values (game-theoretic approach assigning each feature a contribution). Understanding feature importance is critical for model interpretability, debugging, and building trust in AI systems.
How does permutation importance differ from Gini importance?
Permutation importance works by randomly shuffling one feature at a time and measuring the resulting drop in model performance. It is model-agnostic and gives a reliable estimate of feature relevance. Gini importance (or mean decrease in impurity) is specific to tree-based models and measures how much each feature reduces node impurity across all trees. Gini importance can be biased toward high-cardinality features, while permutation importance is generally more robust. For production models, permutation importance on a held-out test set is typically recommended.
Why do some features show high importance but low correlation with the target?
This happens because feature importance captures non-linear and interaction effects that simple correlation misses. A feature may interact with other variables in complex ways that tree-based models can exploit. Additionally, a feature might serve as a proxy for an unmeasured variable, capturing information through indirect pathways. Multicollinearity can also inflate importance of one feature while suppressing its correlated partner. Always combine feature importance with domain knowledge, partial dependence plots, and SHAP analysis for a complete picture.
How many features should I keep in my model?
The optimal number of features depends on the variance explained versus model complexity trade-off. A good rule of thumb is to keep features that collectively explain 90-95% of the target variance. Using too many features increases overfitting risk, training time, and maintenance burden. The elbow method on a cumulative importance plot helps identify the cutoff point. Cross-validation with incremental feature addition provides the most rigorous answer. For production systems, fewer features mean simpler pipelines and reduced data dependency risk.
What is the relationship between dataset size and feature importance reliability?
Larger datasets produce more stable and reliable feature importance estimates. As a rule of thumb, you need at least 30 samples per feature for basic stability, and 100+ samples per feature for robust permutation importance. With small datasets, importance rankings can be noisy and change significantly between runs. Bootstrap aggregation (computing importance across multiple data subsets) can improve stability. The stability score in Feature Importance Explainer estimates how reliable the importance rankings are given your dataset size and feature count.
What is the difference between global feature importance and a local SHAP explanation?
Global importance answers which features matter across the whole dataset; a local explanation answers why one specific prediction came out as it did. SHAP supplies both because it is additive: the SHAP values for a single row sum exactly to that prediction minus the base value, which is the model average output. Averaging absolute SHAP values across many rows yields a global ranking that stays consistent with the local ones. That coherence is why SHAP is preferred when a decision has to be justified to the individual it affects.
What does the normalized entropy score say about the importance distribution?
The tool takes the Shannon entropy of the importance shares, the negative sum of p times log base 2 of p, and divides it by log base 2 of n, the maximum attainable with n features. A value near 100 percent means importance is spread almost evenly, so no small subset can be removed without losing signal. A low value means a handful of features carry the model. Ten features sharing importance equally give an entropy of log base 2 of 10, about 3.32 bits, which normalises to 100 percent. It measures concentration, not model quality.
Why can two highly correlated features both score as unimportant?
Above roughly 0.8 average pairwise correlation, the redundancy flag fires because features are carrying largely the same information and importance methods split the credit between them. Permutation importance suffers most: shuffling one column leaves its twin intact, so the metric barely moves and both score low even though the shared information is essential. Drop either alone and nothing changes; drop both and the model collapses. The fix is to cluster correlated features and score the cluster, or to use conditional permutation, rather than pruning on individual scores.
Should importance be measured on training data or on a held-out set?
Importance computed on training data reflects what the model used to fit that data, noise included, so a feature can rank highly in sample and contribute nothing on unseen rows. That is exactly the signature of overfitting. Permutation importance on a held-out test set answers the operational question instead: how much accuracy is lost if this column goes missing or becomes corrupted in production. When the two rankings disagree sharply, read it as evidence about the model rather than as a puzzle over which chart to believe.
How does target leakage show up in a feature importance chart?
Leakage usually announces itself as one feature dwarfing all the others, alongside validation scores that look implausibly good. The offending column is normally either derived from the target, such as an aggregate computed after the outcome was known, or simply unavailable at the moment the prediction must be made. The test is temporal: for each top-ranked feature, ask whether that exact value would exist at scoring time. A single dominant feature paired with a very low entropy score deserves that audit before the accuracy number is trusted.
References
Background & Theory
History
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer ยท Editorial policy
Related Calculators
๐ฉFeature Flag Rollout Risk Planner
Calculate rollout risk, blast radius, and canary release safety
๐งฎOption Strategy Breakeven Explainer
Calculate option strategy breakeven explainer with inputs, formulas, and instant results.
๐งฎColor Palette Balance AI
Calculate color palette balance ai with inputs, formulas, and instant results.
๐งฎEV Route Charge Planner Range AI
Calculate ev route charge planner range ai with inputs, formulas, and instant results.
๐งฎWork Break Pomodoro Planner AI
Calculate work break pomodoro planner ai with inputs, formulas, and instant results.
๐งฎ3D Print Time Support Estimator
Calculate 3d print time support estimator with inputs, formulas, and instant results.
๐งฎA B Test Significance Power Analyzer
Calculate a b test significance power analyzer with inputs, formulas, and instant results.
๐งฎAccessibility Contrast Optimizer WCAG
Calculate accessibility contrast optimizer wcag with inputs, formulas, and instant results.