Add Shapley attribution and redundancy/nonlinear validation cases to the failure harness - #89
Open
duckyquang wants to merge 1 commit into
Open
duckyquang wants to merge 1 commit into
duckyquang wants to merge 1 commit into
Conversation
Shapley over modality coalitions (v(S) = -MAE(f(S)), all 2^N subsets, the all-masked set included) now sits beside leave-one-out in the complementarity report. LOO under-credits redundant modalities because the twin covers for the dropped one; Shapley counts the coalitions where the twin is absent. Falls back to None past N=8 or when predict_fn cannot mask everything (the fused saved-predictions route). validate_harness.py gains two cases the review of the eval design asked for: a redundancy plant (two equal strong modalities + one weak; Shapley pays each redundant modality ~44% more than LOO) and a nonlinear MLP probe on the planted data (which degrades badly under either mask -- the same out-of-distribution-zeros behavior the real fused checkpoint shows). run_failure_analysis's unknown-subset error becomes KeyError so the harness can degrade gracefully on the optional all-masked probe. 135 tests pass (3 new: efficiency + closed form, redundancy credit, graceful None), ruff clean.
duckyquang
requested review from
gullyboyslok,
kevzho,
noahdanehebdon,
paiksca,
sebasmos,
slhhuang,
tigerkrittaphas and
turkalpmd
September 11, 2026 11:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds exact Shapley values over modality coalitions to the harness's complementarity report, next to the existing leave-one-out numbers. Also adds the two synthetic stress cases the ML4H reviewer report asked for (its point M7): a redundancy plant (two equally strong modalities plus one weak) and a nonlinear MLP probe on the planted data, both wired into
validate_harness.py. The fused saved-predictions route inrun_failure_analysis.pynow degrades gracefully (shapley_value: null) instead of exiting when the all-masked subset has no scored condition behind it.Result
All from real runs on my Mac (CPU; the validation script is synthetic by design):
3.43 / 3.75vs2.38 / 2.62, weak channel0.75vs0.22). This is the textbook LOO blind spot the reviewer flagged — with a single masked checkpoint the twin covers for the dropped modality, so LOO under-credits both.0.587/0.571) — the same out-of-distribution-zeros collapse the real fused checkpoint shows on the cohort, so this doubles as response material for reviewer point M2.sum(phi) = MAE(empty) - MAE(full)) and is tested, along with the N=2 closed form.135 passed, 1 skipped, ruff check + format clean.Notes
shapley_valueisNonepastN=8(2^N predict calls) or whenpredict_fncan't produce the all-masked prediction — the fused-route JSONs only score the three named conditions, so they keep LOO-only attribution.run_failure_analysis.py(SystemExit→KeyError, converted back at the call site) is what lets the harness probe the empty set opportunistically without breaking the script's clean exit message for genuinely missing conditions.