Value above baseline / positive edge Value below baseline / negative edge Unvisited lattice node Current coalition (active path head)

SHAP Feature Attribution: Shapley Lattice & Convergence

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 2D simulator makes the entire computation visible at once as a Boolean coalition lattice — all 32 subsets of a five-feature loan-approval model (with a real feature interaction) arranged by coalition size and heat-mapped by their value v(S) — with a bright animated path showing the current Monte-Carlo permutation climbing from the empty coalition to the full one. A companion convergence chart tracks each feature's running-average estimated attribution against the number of permutations sampled, settling onto the exact Shapley value (computed by brute-force enumeration of all 32 subsets) as dashed target lines. Adjust the instance, toggle the interaction term, and watch the additivity property hold: the estimated attributions always sum to the prediction minus the baseline.