Repository navigation
Add Goda Shapley effects method - #686
Conversation
|
The failed CI job is isolated to I attempted to rerun the failed workflow, but GitHub requires repository-admin permission. If convenient, could a maintainer rerun the pytest workflow? I will address any failure that reproduces in the Shapley scope. |
Implement the N(D+1) independent-input estimator with analytical confidence intervals, CLI support, docs, examples, and Ishigami regression.\n\nRefs SALib#682
a10e481 to
f2cf0d5
Compare
Replace the nested per-trajectory, per-step loop with vectorized numpy calls. Diff all trajectories at once to find which factor changed at each step, then scatter contributions into place with `np.put_along_axis` instead of assigning them one at a time. Results in a ~15-50x runtime improvement since Python loop overhead is the bottleneck.
|
Many thanks for this implementation @DresdenGman I've added the performance improvement I mentioned which vectorises the nested for-loops. Looping in Python is comparatively slow so we see a 15-50x improvement:
Timings taken with the help of AI. It does introduce increased memory use but it is only a concern for very large number of samples and dimensions.
|
Add Goda Shapley effects method
Closes #682.
Summary
This adds a Shapley-effects implementation based on the random-permutation estimator described by Goda (2021). The implementation follows SALib's existing sample/evaluate/analyze workflow:
SALib.sample.shapleygenerates the paired hybrid samples required by the estimator usingN * (D + 1)model evaluations.SALib.analyze.shapleyreturns effects in the model-output variance scale, confidence intervals derived from the estimator's sample variance, and anormalizedview whose effects sum to one.ProblemSpecdynamic methods.The initial scope supports independent, ungrouped inputs. A user-provided conditional-sampling callback for dependent inputs would require an API that can participate before external model evaluation; I have left that extension out of this PR so it can be designed separately without coupling sampling to model execution.
Validation