Repository navigation
Fix Sobol analysis for partially constant multi-output columns - #678
Conversation
When y is 2D with some columns constant and others varying, np.ptp(y) returns a scalar over the flattened array, missing per-column zero-variance. Use np.divide with per-column where= clause to avoid producing NaN for constant columns. Closes SALib#619
|
Thanks for the PR @DresdenGman Could you follow the instructions here to resolve the linting issue https://github.com/SALib/SALib/actions/runs/28746038699/job/85308403437?pr=678#step:4:140 I haven't had a close look, but it seems like it's complaining that the |
|
Thanks for the pointer. I pushed a small lint-only fix in I also reran |
|
This looks acceptable to me, although there is an open question of how we'd handle this more formally across all methods in the longer term. @tupui unless you have comments/concerns I'll merge this soon |
tupui
left a comment
There was a problem hiding this comment.
Just one comment on my end. Thanks for the ping 😃
first_order and total_order guard against per-column zero variance, but second_order's Vjk computation still divided by np.var(y, axis=0) directly, producing NaN for constant columns when other columns vary.
|
Reviewed and this looks ready to merge, with one addition: second_order's Vjk computation still divided by Pushed d2b9787 to apply the same pattern as for first/total order and added a regression test. I shall merge once CI passes. |
Fixes #619.
For multi-output analysis, the previous scalar
np.ptp(y)check could miss constant output columns and produce invalid Sobol indices. This applies per-column zero-variance handling and adds regression coverage for mixed constant and varying outputs.