Repository navigation
Description
First raised in #707
Description
The group-support standardization (analysis-side aggregation across
analyzers) left a few deliberate follow-ups out of scope to keep that change
reviewable. This issue collects them for future work.
Deferred items
1. Shared aggregation entry point + ungrouped output
Each analyzer currently repeats the same pattern inline:
var_names, n_groups = extract_group_names(problem)
...
if n_groups < num_vars:
groupings, _ = compute_groups_matrix(problem["groups"])
Si[key] = _group_metric(groupings, key)Two related improvements:
- Consolidate the decision + aggregation into a single helper (e.g.
group_results(Si, problem, metric_keys)) so the convention lives in one
place. The samplers'_check_groups()usage would be untouched; this is
analysis-side only. - Expose the pre-aggregation per-factor values alongside the group rows, e.g.
Si["ungrouped"]. Averaging can dilute a single dominant member (a group
with one important and two inert factors reports ~1/3 of the important one),
and users currently cannot see which member drives a group average.
Design considerations noted during review:
- Morris /
radial_ee: thesigma-is-NaN-for-multi-member-groups convention
needs a hook in the shared helper. - Sobol: the S2 matrix is computed at group resolution by construction rather
than aggregated from per-factor values, so it must be excluded from any
generic metric-key aggregation. delta: the per-factornotesrelabeling stays analyzer-specific.
2. Group-aware Shapley effects
shapley (sampler and analyzer) currently warns and ignores group
definitions, reporting per-factor results (matching the ff/hdmr
convention). Aggregating Shapley effects by averaging would be incorrect:
Shapley values combine over a bundle by summation, not averaging. Proper
group support would report a group's Shapley effect as the sum of its members'
values (the bundle property), which preserves the total-variance
decomposition. Group co-sampling at the trajectory stage is a separate, larger
question.
3. Minor cleanups noticed along the way
- A shared grouped-sigma helper between
morrisandradial_ee(the
sigma-NaN logic is currently duplicated in both). - NaN propagation behavior when averaging grouped
deltaresults via
np.ma.mean(masked arrays hide NaN members silently). deltaincludes itsnoteskey in the metric-keys loop, which is harmless
today but fragile ifnotesever becomes numeric.
Context
- The convention adopted (and to be preserved/refactored, not reinvented):
per-variable metrics are computed individually and the average across group
members is reported;Si["names"]becomes the unique group names. A problem
defining a single group aggregates to one row named for that group. - Averaging caveats are documented in
_group_metricNotes and the affected
analyzer docstrings (signed-metric cancellation; averaged confidence
intervals understate group-level uncertainty). - Grouped sampling inherently does not resolve interactions between members of
the same group; no aggregation scheme changes this.
Activity
DresdenGman commentedon Nov 3, 2026
Hi @ConnectedSystems — I wrote the Goda Shapley estimator in #686, and I'd like to pick up item 2 from this list (group-aware Shapley effects) if that's welcome.
I've read through the spec here and the current code. The summation requirement is clear: a group's effect is the sum of its members' values (the bundle property) rather than the masked mean used by the other analyzers, so this can't ride on
_group_metric. Implementation-wise, the cleanest place to aggregate is the per-trajectory contribution matrix insideanalyze: summing member contributions per trajectory and then running the existing mean, confidence, and normalization logic on the group-level contributions preserves the total-variance decomposition exactly, while ensuring the group CIs properly account for within-trajectory covariance between members' contributions. The sampler itself needs no group logic — trajectories are per-factor by construction — so on that side it would simply stop rejecting (or warning about) grouped problems.The scope I have in mind is strictly item 2:
analyze/shapley: aggregate contributions by group when a problem defines groups; setnamesto the group names following the convention in Expanded support for group analysis #707 (including collapsing the single-group case to one row)sample/shapley: drop the group rejection/warning and update the docstring, with no changes to the sampling scheme (leaving group co-sampling out, as noted in the issue)shapleyOut of scope: the item 1 helper refactor, an
ungroupedkey, and the item 3 cleanups.Three things I'd like to confirm before writing code:
mainonce Expanded support for group analysis #707 lands, or would you rather I stack it onfeature/group-analysis?shapley_conf/shapley_normalized_confat the group level?Happy to adjust the scope — or to leave this with you if you'd prefer to fold it into #707.
ConnectedSystems commentedon Nov 5, 2026
Yes, happy to see your continued contributions!
ConnectedSystems commentedon Nov 15, 2026
#707 now merged in
Merge pull request #716 from DresdenGman/feat-708-group-analysis