Positive contribution Negative contribution Not yet in coalition Coalition value v(S)
⚠ Couldn't load the 3D engineThree.js failed to load from the CDN. Check your connection and reload.

SHAP Feature Attribution: Shapley Values by Coalition Sampling

SHAP (SHapley Additive exPlanations) attributes a model's prediction to its input features using the Shapley value from cooperative game theory: the average marginal contribution of a feature across every possible order in which features are revealed. This simulator makes that process visible in 3D for a five-feature loan-approval model with a real feature interaction. Random permutations animate as a coalition being built one feature at a time — the front row of bars lights up as each feature joins and a gold ladder climbs the coalition's running value — while a back row of bars accumulates each feature's running-average marginal contribution, converging toward the exact Shapley value (computed by brute-force enumeration of all 32 subsets) as more permutations are sampled. Adjust the instance, toggle the interaction term, and watch the additivity property hold: the estimated attributions always sum to the prediction minus the baseline.