-
Notifications
You must be signed in to change notification settings - Fork 3
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
Refactor for more multi dispatch #79
Conversation
…newal` to a callable on `Renewal`
…rs not being exported (used internally now)
Thanks looking now. Do you have a view on the CI failures? Also could you address how/why this the questions in #78 directly |
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.
Looks much improved from sight read. Running locally now but could you address the design question in #78 directly please
The current CI problem seems to be some kind of async between my pre-commit hook of format style that has emerged since I switched to my laptop... Possibly need to update |
#78 addresses potential problems with splatting unknown Dicts of priors down to a function call which expects some definite arguments. My contention is that this refactor solves that problem in a different way; by creating a concrete type to dispatch a behaviour (e.g. choose Random walk latent process) with known and typed fields. This allows the input of the method that implements random walk to use the struct as an input. |
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.
This looks good and seems to work nicely. Thanks for the explanation and I'm happy to go with the pure struct approach. I would like us to make sure we very clearly document the connect between the struct and their functions and what and how internal struct objects are used by those functions (as that is my remaining concern).
Goal
To refactor the code base to enforce a separation between types which define the behaviour of the model, e.g. targetting direct log-infections for inference as opposed to the time-varying reproductive number, from the implementation of this which is handled by methods.
Lower-level interface
The core lower level methods are:
generate_latent_process(latent_process::AbstractLatentProcess, n)
which implements the latent process forn
stepsgenerate_latent_infs(epimodel::AbstractEpiModel, latent_process)
which implements initial incidence and ingestion of latent process to generate latent infections.generate_observations(observation_model::AbstractObservationModel, y_t, I_t; pos_shift)
which implements how the latent incidenceI_t
either generates observations (ify_t = missing
) or accumulates log-like ify_t
is given withpos_shift
being an up-jitter to miss out on exact zeros in prediction.Higher-level interface
Based on
make_epi_inference_model
which takes in obs. data (ormissing
) and defined structs to dispatch the lower level methods on.New model diagram
Closes #78
Closes #75