You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement method of Goda for Shapley effects estimation #682
I worked through Goda (2021) and now have a complete prototype on this branch.
The current design:
generates two independent input draws per Monte Carlo replication and a random permutation trajectory, for exactly N * (D + 1) model evaluations;
reconstructs the changed factor from consecutive input rows and applies the paper estimator to all factors simultaneously;
returns raw Shapley effects in output-variance units plus the normal-approximation confidence half-width from the unbiased variance estimator, without bootstrap resampling;
explicitly limits the implementation to independent, ungrouped inputs, matching the assumptions of the published algorithm;
includes the CLI and ProblemSpec workflows, docs, Python/shell/Windows examples, input validation, an analytical Ishigami regression, and a test of the identity that the estimated effects sum to the paired-difference variance estimate.
The focused sampler, analyzer, CLI, and interface suite passes 33 tests. The broader suite reached only the existing stochastic test_regression_delta_svm failure; that test passed when rerun in isolation.
Before opening the PR, could you confirm the preferred result convention: raw effects that estimate contributions to output variance (the current Shapley result), or normalized shares that sum to one? I currently favor keeping the raw estimator as the primary result so its unbiasedness and confidence-interval interpretation are preserved, while documenting normalization as Si["Shapley"] / Si["Shapley"].sum().
It includes an extension to handle dependent factors and there are tests that you could probably re-use in that repo as well.
Normalized shares that sum to 1 is my preference - however, I think we can provide this as a property.
On top of this, I had a few ideas on how to make the analysis a bit more straightforward and potentially computationally performant too but I'll need to revisit the code to refresh my memory.
Thanks — that direction makes sense. I have updated the prototype so the result keeps the raw variance-unit Shapley values and confidence half-widths, while Si.normalized exposes the unit-sum shares. I also added tests for the unit-sum property and the undefined zero-total case, and updated the example. The focused sampler/analyzer/interface/CLI suite passes 25 tests; the full suite reached 232 passed and 1 expected xfail, with only the existing stochastic test_regression_delta_svm failure, which passed immediately in isolation.
I also reviewed SAShE.jl's dependent-factors branch. Its extension asks a user-supplied callback for conditional draws during each permutation step. That is a useful direction, but it does not map directly onto SALib's current sample → external model evaluation → analyze separation without designing a broader conditional-sampling workflow. My preference is therefore to keep the first contribution focused on the published independent-input algorithm, then treat dependent factors and the performance ideas as a follow-up design once you have had a chance to revisit them.
The updated prototype remains on new_method_shapley. I am happy to adjust the property name or result structure if you have a preferred SALib convention.
I also reviewed SAShE.jl's dependent-factors branch. Its extension asks a user-supplied callback for conditional draws during each permutation step. That is a useful direction, but it does not map directly onto SALib's current sample → external model evaluation → analyze separation without designing a broader conditional-sampling workflow.
I may be missing something but the sample method defined for shapley could accept a user-provided function. The process could then conduct the conditional draws if such a function is provided.
If you submit a PR (and enable maintainers to edit/change code) I should be able to take a look soon.
Activity
DresdenGman commentedon Aug 31, 2026
I worked through Goda (2021) and now have a complete prototype on this branch.
The current design:
N * (D + 1)model evaluations;ProblemSpecworkflows, docs, Python/shell/Windows examples, input validation, an analytical Ishigami regression, and a test of the identity that the estimated effects sum to the paired-difference variance estimate.The focused sampler, analyzer, CLI, and interface suite passes 33 tests. The broader suite reached only the existing stochastic
test_regression_delta_svmfailure; that test passed when rerun in isolation.Before opening the PR, could you confirm the preferred result convention: raw effects that estimate contributions to output variance (the current
Shapleyresult), or normalized shares that sum to one? I currently favor keeping the raw estimator as the primary result so its unbiasedness and confidence-interval interpretation are preserved, while documenting normalization asSi["Shapley"] / Si["Shapley"].sum().ConnectedSystems commentedon Aug 31, 2026
Wow, amazing @DresdenGman
I was intending to do this myself by porting an implementation (in Julia) by my colleague @Zapiano found here: https://github.com/Zapiano/SAShE.jl
It includes an extension to handle dependent factors and there are tests that you could probably re-use in that repo as well.
Normalized shares that sum to 1 is my preference - however, I think we can provide this as a property.
On top of this, I had a few ideas on how to make the analysis a bit more straightforward and potentially computationally performant too but I'll need to revisit the code to refresh my memory.
DresdenGman commentedon Aug 31, 2026
Thanks — that direction makes sense. I have updated the prototype so the result keeps the raw variance-unit
Shapleyvalues and confidence half-widths, whileSi.normalizedexposes the unit-sum shares. I also added tests for the unit-sum property and the undefined zero-total case, and updated the example. The focused sampler/analyzer/interface/CLI suite passes 25 tests; the full suite reached 232 passed and 1 expected xfail, with only the existing stochastictest_regression_delta_svmfailure, which passed immediately in isolation.I also reviewed SAShE.jl's
dependent-factorsbranch. Its extension asks a user-supplied callback for conditional draws during each permutation step. That is a useful direction, but it does not map directly onto SALib's current sample → external model evaluation → analyze separation without designing a broader conditional-sampling workflow. My preference is therefore to keep the first contribution focused on the published independent-input algorithm, then treat dependent factors and the performance ideas as a follow-up design once you have had a chance to revisit them.The updated prototype remains on
new_method_shapley. I am happy to adjust the property name or result structure if you have a preferred SALib convention.ConnectedSystems commentedon Sep 1, 2026
I may be missing something but the
samplemethod defined forshapleycould accept a user-provided function. The process could then conduct the conditional draws if such a function is provided.If you submit a PR (and enable maintainers to edit/change code) I should be able to take a look soon.
Thank you.
feat: add Goda Shapley effects method