Calculator Inputs
Formula Used
Mean decrease in impurity assigns credit whenever a feature improves a split. Tree credits are weighted by reached samples and averaged across trees. The calculator accepts those final scores for flexible visualization.
MDIj = (1 / T) × Σt=1..T Σs∈j,t (Ns / N) × [I(s) − (NL/Ns)I(L) − (NR/Ns)I(R)]
NIj = Ij / Σk=1..p |Ik|
PIj = 100 × Ij / Σk=1..p |Ik|
Permutation importance instead measures score loss after shuffling one feature. Signed values can reveal helpful, harmful, or unstable measured effects. Absolute normalization keeps mixed signs comparable within one ranking.
How to Use This Calculator
- Paste feature names using lines, commas, or semicolons.
- Paste matching importance values in the same order.
- Add optional uncertainty values from repeated training runs.
- Select the method matching your source scores.
- Choose transformations, scaling, sorting, thresholds, and display limits.
- Submit the form to generate metrics, rankings, and the plot.
- Download the displayed table when further analysis is needed.
Understanding Random Forest Feature Importance
Random forests combine many decision trees to produce stable predictions. Each tree chooses splits that reduce uncertainty within sampled training records. Importance scores summarize how strongly features support those useful splits.
Large scores indicate repeated influence across trees and sampled observations. Small scores suggest limited contribution under the fitted forest structure. However, weak rankings never prove a feature lacks business value.
How Forest Importance Is Measured
Impurity importance records each split's weighted reduction in node uncertainty. Credits accumulate whenever the same feature appears across different trees. Averaging those credits creates one global score per feature.
Permutation importance uses a separate validation set and baseline metric. Each feature is shuffled while other columns remain unchanged. Larger performance losses indicate stronger predictive dependence on that feature.
Reading the Importance Plot
Sorted bars reveal the strongest predictors before weaker variables. Percentage scaling shows each feature's share of total absolute importance. Cumulative lines reveal how quickly the leading predictors dominate.
A steep cumulative curve indicates concentrated predictive influence. A gradual curve suggests information is distributed across many variables. Effective feature counts summarize this concentration with one comparable number.
Handling Negative and Duplicate Scores
Negative permutation values can appear when shuffling accidentally improves validation performance. Such values often signal noise, correlation, or unstable estimation. Keep signs when diagnosing behavior across repeated evaluation runs.
Absolute transformation emphasizes magnitude without preserving effect direction. Positive clipping removes negative contributions before plotting ranked results. Duplicate aggregation combines repeated names from grouped or encoded inputs.
Improving Ranking Reliability
Repeat training with different seeds before trusting narrow score differences. Add uncertainty values from folds, seeds, or bootstrap samples. Wide error bars warn that nearby rankings may switch.
Correlated features may divide importance despite carrying similar information. Impurity methods can favor continuous or high-cardinality predictors. Compare permutation results before removing apparently weak correlated variables.
Comparing Models and Datasets
Compare rankings across model versions using identical validation samples. Stable leaders should remain prominent despite reasonable seed changes. Large ranking shifts may expose drift, leakage, or tuning sensitivity.
Dataset comparisons require consistent feature definitions, preprocessing, and scoring methods across projects. Otherwise, apparent changes may reflect measurement differences rather than learning alone. Document every configuration clearly before presenting trends to technical stakeholders.
Using Results Responsibly
Importance describes model reliance rather than direct causal influence. Strong rankings can still reflect leakage or biased data. Review collection methods before communicating important model drivers.
Combine plots with validation metrics, partial dependence, and domain review. Test performance after removing features or changing preprocessing choices. Reliable interpretation requires evidence beyond one attractive chart alone.
Frequently Asked Questions
1. What does random forest feature importance measure?
It estimates how strongly each input supports the fitted forest. The exact meaning depends on the selected importance method. It does not prove causation or real-world necessity.
2. Should importance values always sum to one?
Raw values may use any consistent scale. Normalized values sum by absolute magnitude when scores contain signs. Percentage mode converts that normalized magnitude into one hundred percent.
3. Why can permutation importance become negative?
Shuffling may occasionally improve performance because of noise or sampling variation. Negative values can also indicate unstable or redundant predictors. Repeated runs help distinguish patterns from chance.
4. Why do correlated features receive smaller scores?
Correlated predictors can share similar information within the forest. One feature may replace another across different trees and splits. Their individual rankings may understate their combined contribution.
5. What uncertainty values should I enter?
Use standard deviations from repeated seeds, folds, or permutation repeats. Keep values aligned with their corresponding feature names. Leave the field empty when uncertainty estimates are unavailable.
6. What does effective feature count mean?
It converts concentration into an intuitive number of equally important features. Lower values indicate stronger dominance by fewer predictors. Higher values indicate broader distribution across the feature set.
7. Should I remove every low-importance feature?
No, because low rankings can result from correlation or estimation bias. Test removal through controlled validation and monitor performance changes. Preserve features required for policy, fairness, or operational reasons.
8. Which importance method is most reliable?
No method is universally best for every dataset. Permutation scores often provide stronger validation-based evidence than impurity rankings. SHAP values add local explanations but require careful interpretation.
9. Can this plot explain individual predictions?
This plot mainly summarizes global feature influence across many predictions. Individual explanations require local methods and observation-level analysis. Use rankings with validation metrics and domain evidence together.