What Is Feature Importance in Random Forest? Gini vs Permutation Explained

Clinical Epidemiology ResearchUniqcret doctor knowledgesMethodology and Research DesignMethodologic [Methodology]
On this page

What is Feature Importance?

Feature importance answers the question:

“Which predictors contribute most to the model’s predictions?”

Importantly:

  • Feature importance does not change model performance
  • It is used for interpretation, especially in clinical research

Two main methods are used:

  1. Impurity-based importance (Gini importance)
  2. Permutation-based importance

Method 1: Impurity-Based Importance (Gini Importance)

Core Idea

Each time a feature is used to split a node, it reduces impurity (e.g., Gini).The total importance of a feature is:

Sum of all impurity reductions across all trees

How It Works

Across the forest:

FeatureTotal impurity reductionNormalized importance
AgeHigh cumulative reductionHighest importance
GCSModerate reductionModerate importance
SBPModerate reductionModerate importance
HRSmall reductionLow importance
RRVery small reductionLowest importance

Interpretation

PropertyBehavior
Computation timingDuring model training
MechanismTracks impurity reduction
SpeedFast
Output meaning“How often and how effectively a feature was used for splitting”

Limitation: Systematic Bias

Bias toward high-cardinality features

Feature typeBehavior in impurity importance
Many categories (e.g., hospital ID)Artificially high importance
Continuous variablesFavored
Binary variablesUnderestimated

Why this happens

  • Features with more possible split points→ more opportunities to reduce impurity→ higher accumulated importance

Even if the feature is not clinically meaningful

Example Interpretation

ScenarioResult
Hospital ID (many categories)Appears highly important
Age (continuous)Appears important
True clinical predictorsMay be underestimated

This leads to misleading conclusions in interpretation.


Method 2: Permutation-Based Importance

Core Idea

Instead of tracking splits, this method asks:

“If I destroy this feature’s information, how much worse does the model perform?”

How It Works

Step-by-step logic

  1. Compute baseline model performance(e.g., AUROC = 0.850)
  2. Randomly shuffle one feature (break its relationship with outcome)
  3. Recompute performance
  4. Importance = performance drop

Example Results

FeatureBaseline AUROCShuffled AUROCPerformance dropImportance
Age0.8500.7200.130High
GCS0.8500.7400.110High
SBP0.8500.8100.040Moderate
HR0.8500.8300.020Low
RR0.8500.8450.005Very low

Interpretation

PropertyBehavior
Computation timingAfter model training
MechanismMeasures performance degradation
SpeedSlower
Output meaning“How much this feature contributes to prediction accuracy”

Why Permutation Importance is Unbiased

Example 1: Many categories vs true signal

FeatureTrue predictive valueImpurity importancePermutation importance
Hospital IDNoneHigh (biased)Near zero (correct)
AgeStrongModerateHigh (correct)

Example 2: Continuous vs binary

FeatureTypeTrue effectImpurity resultPermutation result
AgeContinuousModerateHigh (biased)Moderate
SexBinaryModerateLow (biased)Moderate

Key Insight

Permutation importance reflects:

Actual contribution to predictive performance

not:

Opportunity to create splits


Side-by-Side Comparison

AspectImpurity-Based ImportancePermutation-Based Importance
When computedDuring trainingAfter training
MechanismSum of impurity reductionsPerformance drop after shuffling
SpeedFastSlower
BiasBiased (toward many categories/continuous)Unbiased
InterpretationModel usage frequencyTrue predictive contribution
Use caseQuick explorationClinical reporting and publication

Clinical Interpretation Perspective

In clinical prediction modeling:

  • The goal is not:
    • “Which variable is used often?”
  • The goal is:
    • “Which variable actually improves prediction?”

Permutation importance aligns with this goal.

This is consistent with prediction modeling principles:

  • Focus on predictive contribution, not structural artifacts
  • Avoid misleading interpretations due to model mechanics

Practical Recommendation for Clinical Papers

  • Do not rely on impurity-based importance for interpretation
  • Use permutation-based importance for reporting

Reason:

  • It reflects real impact on model performance
  • It is methodologically defensible
  • It aligns with clinical reasoning

Conceptual Summary

Feature importance methods differ in what they measure:

  • Impurity-based importance → how often a feature is used
  • Permutation-based importance → how much a feature matters

Key Takeaways

  • Feature importance does not affect model performance, only interpretation
  • Impurity-based importance is fast but biased toward certain variable types
  • Permutation-based importance measures true contribution to prediction
  • In clinical research, permutation importance is preferred for validity
  • Misinterpreting feature importance can lead to incorrect clinical conclusions

0
Message for International and Thai ReadersUnderstanding My Medical Context in ThailandRead more →Message for International and Thai ReadersUnderstanding My Broader Content Beyond MedicineRead more →

Comments

No comments yet. Be the first to share your thoughts.

Sign in to comment