Fix nondeterministic preprocessing extension - #145
Open
aryamanDutta wants to merge 1 commit into
Open
Conversation
Author
|
Hey mentors I’ve opened this PR to address #136. I traced the reproducibility issue to the internal MCMC sampling used by PreProcess.reduce(extend=True). The PR adds support for supplying precomputed steady_states to bypass that sampling while preserving the existing behavior with a warning when they aren't provided. |
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.
**Fixes #136.
What does this implement/fix? Describe your changes.
PreProcess.reduce(extend=True)internally uses MCMC sampling to obtain steady states, which are then used to calculate reaction correlations. Due to the use of an internal random number generator, settingnp.random.seed()has no effect on the reproducibility of this particular random number generator.This PR adds the possibility to supply precomputed
steady_statestoreduce():If
steady_statesare supplied when callingreduce(), internal MCMC sampling is not performed, and the providedsteady_statesare used for computing the reaction correlation matrix. In this case, thesteady_statesargument is validated to be a 2D array with shape(number of reactions in reduced model) x (number of samples).If
steady_statesare not supplied, the internal MCMC sampling is performed; however, aUserWarningis raised to remind the user that reproducibility of results is not guaranteed.Tests
Modified tests cover the cases when user-supplied
steady_statesare used in the calculation of the reaction correlation matrix withextend=True, as well as invalid dimensions of suchsteady_states. All the tests passed: