Repository navigation
Add group-aware Shapley effects (#708, item 2) - #716
Merged
Merged
Conversation
Aggregate the per-trajectory contributions by group in the Shapley analyzer, so a group's effect is the sum of its members' effects (the bundle property) and the confidence intervals account for the covariance between members' contributions. Report shapley_abs (mean absolute contribution) alongside the signed effects, following the Morris mu/mu_star convention. The sampler still generates per-factor trajectories; it now warns that group definitions do not change the sample design (no group co-sampling) instead of warning that groups are unsupported.
ConnectedSystems
approved these changes
Nov 22, 2026
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.
Implements item 2 of #708: group-aware Shapley effects.
Analyzer (
analyze/shapley.py)contributions @ compute_groups_matrix) before the existing mean/variance/delta-method machinery runs, so a group's Shapley effect is the sum of its members' effects (the bundle property), and the group confidence interval accounts for the covariance of member contributions within a trajectory — rather than averaging member intervals.shapley_absandshapley_abs_conf: the mean absolute per-trajectory contribution and its confidence half-width, alongside the signedshapleyvalues. Reported for grouped and ungrouped problems alike; the signed/absolute pair makes cancellation between member contributions visible.Si["names"]now holds the group names; a single-group problem collapses to one row, and identity grouping reproduces the previous output exactly.Sampler (
sample/shapley.py)Tests / docs
shapley_absstays visible while the signed value cancels.tests/test_group_analysis.py; support matrix updated inREADME-advanced.mdanddocs/user_guide/advanced.rst; CHANGELOG entry added.Test results: the affected test files go from 40 passed (baseline main) to 44 passed; the full test suite passes (378 passed, 1 xfailed).
Scope: only item 2 of #708. Item 1 (shared aggregation helper /
Si["ungrouped"]), the item 3 cleanups, and group co-sampling are not included.