NeuroNomixer
  • Home
  • Blog
  • Visual Guides
  • Authors
  • Contact
Sign InSign Up
HomeBlogAuthorsContactPrivacy Policy

© 2026 NeuroNomixer — Built with Next.js & Tailwind CSS

Visual Guides/Feature Importance and SHAP Intuition
Machine Learning

Feature Importance and SHAP Intuition

A trained model is a black box until you interrogate it. Train a real tree ensemble on 60 visible rows, break each feature with a permutation to measure what mattered globally, then decompose one prediction into per-feature pushes that sum exactly to the output.

Train the 12-tree forest
Shuffle 2 different columns
Spot the top feature
Explain one prediction

Sign in to save progress

Two different questions, two different tools

"Which inputs does my model rely on?" is a global question about the whole model. "Why did it predict THIS for THIS row?" is a local question about one prediction. Both are model inspection: they describe what the trained model uses, which is not the same as what causes churn in the world.

Global: permutation importance

Shuffle one column so its values no longer line up with the right rows, then remeasure accuracy. The information channel is cut while the column's distribution stays intact. A big drop means the model was leaning on that feature.

Local: additive attribution

Start from the model's base rate and credit each feature with a signed push, so that base plus pushes equals the prediction exactly. SHAP is the best-known scheme; for trees we can read an exact additive decomposition straight off the decision paths.

A property of the model, not the world

Importance tells you what this particular model uses. Correlated features split credit in arbitrary ways, and a feature can matter in the world yet score zero because the model found a substitute. Never read importance as causality.

Step 1: meet the data, then train a real forest on it

Every row is visible below: a toy churn dataset generated with a fixed seed. By construction the label leans hard on usage, moderately on tenure, lightly on support calls, and ignores the zip digit entirely. The model never sees that recipe; your job is to recover it from the trained forest.

60 customers4 features25 churned35 stayed
RowUsage (hrs)Tenure (mo)CallsZip digitOutcome
21128Churned
342453Stayed
374129Stayed
274235Stayed
372717Stayed
113828Stayed
222960Stayed
204566Stayed
113777Churned
282648Stayed
121431Churned
34123Stayed
271135Churned
272015Stayed
293432Stayed
291416Stayed
71870Churned
283974Stayed
73926Churned
112225Stayed
63627Stayed
261003Stayed
184801Stayed
302937Stayed
391727Stayed
35306Stayed
142079Churned
154147Stayed
194528Stayed
14766Churned
111611Churned
344134Stayed
152350Churned
154452Stayed
51459Churned
1907Churned
3757Churned
363342Stayed
311514Stayed
313800Stayed
184258Stayed
52932Churned
93029Stayed
92310Stayed
163042Churned
83148Churned
93878Churned
363605Stayed
221509Stayed
62367Churned
292630Stayed
153675Churned
102572Churned
81405Churned
233056Stayed
201413Stayed
301164Churned
151560Churned
184155Churned
123351Churned

The model

A bagged ensemble of 12 CART trees, depth at most 3, at least 4 rows per leaf, each trained on a deterministic bootstrap of these 60 rows. Leaves store the mean churn label, so the forest outputs a probability. Training is real and runs in your browser; the fixed seed means retraining rebuilds the same forest.

0 of 12 trees built

Step 2: break features one at a time

Shuffle a column and the table in Step 1 updates: the values are really permuted (a fixed, seeded shuffle) and the accuracy bar is recomputed by running all 60 rows back through the forest. Shuffle a column the model relies on and accuracy craters; shuffle the noise column and nothing happens.

Monthly usage (hrs)

hours of product use per month

Tenure (mo)

months as a customer

Support calls

support tickets in the last quarter

Zip last digit

last digit of the zip code, pure noise by construction

Train the forest in Step 1 first; without a model there is no accuracy to break.

Accuracy on the 60 rows, recomputed live

Waiting for a trained forest.

Measured permutation importance

Shuffle at least two different columns above to unlock the per-feature measurement. Try one column the model should care about and one it should not.

Step 3: which feature does YOUR forest lean on most?

Answer from the evidence you just generated: the correct option is whichever feature has the largest measured accuracy drop for the forest you trained, not a hardcoded answer key.

Train the forest first; the answer is measured from it.

Step 4: explain one prediction, exactly

Global importance says what the model uses on average. For a single customer we can do better: walk each tree's decision path and credit every split to the feature that made it. The result is a SHAP-style waterfall whose bars sum exactly to this forest's prediction for that row.

Train the forest first: attributions are read off the trained trees.

The waterfall appears once you have a trained forest and a selected row.

← All GuidesNext Guide →