-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stochastic transitions #474
base: develop
Are you sure you want to change the base?
Conversation
…g probability of e.g. elimination of a disease
… than creating local ones
…d runs are reasonably matched historically
…ropriate Random seeds for runs ensures consistency (some needless rerunning of seeded runs that will fail between scenarios though)
…with a ">" residual link. - `outflow` wasn't updated with the stochastic outflow_fractions, and - The probabilities need to sum to 1 in a multinomial so we give the residual probability to the residual link - Also checks that net_inflow is an integer and throws an error if it is not
Fix ResidualJunctionCompartment not applying stochasticity correctly
One thing that would be nice to look into for this is having the |
Allow transfer duration units, improved error handling
Documentation update
…ca into stochastic_transitions
…nt the whole dataframe as it is
@@ -2248,6 +2322,23 @@ def build(self, parset): | |||
obj.preallocate(self.t, self.dt) | |||
pop.initialize_compartments(parset, self.framework, self.t[0]) | |||
|
|||
#More finally, set up acceptance criteria for those which should be checked at runtime (variables that have ._is_dynamic = True), and those which can only be checked after conclusion | |||
if self.acceptance_criteria: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should be more generic about this in Atomica e.g., support a generic callable and defer the specific validation method to the user
|
||
if rand_seed is not None: | ||
rng = np.random.default_rng(seed = rand_seed) | ||
seed_samples = rng.integers(1e15, size=n_samples) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some new recommendations for this using SeedSequence
atomica/model.py
Outdated
@@ -1954,13 +2016,16 @@ def report_characteristic(charac, n_indent=0): | |||
|
|||
# Otherwise, insert the values | |||
for i, c in enumerate(comps): | |||
c[0] = max(0.0, x[i]) | |||
if self.stochastic: | |||
c[0] = stochastic_rounding(max(0.0, x[i]), rng_sampler = self.rng_sampler)#integer values (still represented as floats) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the rounding is done here after checking initial condition validity is it possible that this could introduce invalid initial conditions? Or otherwise introduce discrepancies with the initial characteristic values?
…tochastic_transitions
…tiple figures plotting in parallel
Feb 2024 updates
…chastic_transitions
Previous "if value" didn't make sense as an object - was always True, using (value.vals of value.assumption) will still generally return True based on defaults, but allows prefilling interaction tables when generating a databook if data has been specified already
WIP PR for adding stochastic transition functionality