Add random_state to DummyOutcomeRefuter for reproducible refutations#1557
Merged
amit-sharma merged 1 commit intoJun 6, 2026
Merged
Conversation
Signed-off-by: Imran Ahamed <immu4989@gmail.com>
This was referenced May 31, 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.
Follow-up to #1556, part of making DoWhy's refutation results reproducible (related: #556, #418).
What
DummyOutcomeRefuteris the only refuter whose randomness cannot be seeded.refute_dummy_outcome,_refute_once,process_data,noise, andpermuteall draw from the global numpy random state, and the train/validation split uses an unseededDataFrame.sample(). As a result, running the dummy-outcome refutation twice on the same data yields different results.The sibling refuters —
BootstrapRefuter,DataSubsetRefuter,PlaceboTreatmentRefuter, andRandomCommonCause— already expose arandom_stateparameter. This PR bringsDummyOutcomeRefuterin line with that established API.Changes
random_statetoDummyOutcomeRefuterand thread it throughrefute_dummy_outcome→_refute_once→process_data→noise/permute, plus the train/validationDataFrame.sample()calls.RandomCommonCause: accept anintornp.random.RandomState, convert once, and pass it throughjoblib.Parallel.random_state=None) preserves existing behavior, so this is backward compatible.Verification
tests/causal_refuters/test_dummy_outcome_refuter.pypass.