Skip to content
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

Improve the prior interface for make epi model inference #61

Merged

Conversation

SamuelBrand1
Copy link
Collaborator

@SamuelBrand1 SamuelBrand1 commented Feb 21, 2024

Goals

This PR aims to address modularity problems for priors discussed here #45 . The goal is to have the choice of priors for a sub-process or sub-model "live" with the Turing model definition of the sub-process or sub-model within a struct.

API changes

  • The make_epi_inference_model constructor for the overall Turing model now requires positional arguments require args of type LatentProcess for the latent process and ObservationModel for the observation model.
  • random_walk and delay_observations are no longer exported by using EpiAware.
  • The constructor delay_observations_model creates an ObservationModel with basic delayed observation model here. If priors are not supplied the defaults are used.
  • The constructor random_walk_process creates a LatentProcess with basic random walk model here.

Proposed EpiAware model diagram

flowchart LR

    A["Underlying dists.
and specify length of sims
---------------------
EpiData"]

    B["Choice of target
for latent process
---------------------
DirectInfections
    ExpGrowthRate
    Renewal"]

C["Observational Data
---------------------
Obs. cases y_t"]
D["Latent processes
---------------------
random_walk"]
E["Turing model constructor
---------------------
make_epi_inference_model"]
F["Latent Process priors
---------------------
default_rw_priors"]
G[Posterior draws]
H[Posterior checking]
I[Post-processing]
DataW[Data wrangling and QC]
J["Observation models
---------------------
delay_observations"]
K["Observation model priors
---------------------
default_delay_obs_priors"]
ObservationModel["ObservationModel
---------------------
delay_observations_model"]
LatentProcess["LatentProcess
---------------------
random_walk_process"]

A --> EpiModel
B --> EpiModel
EpiModel -->E
C-->E
D-->LatentProcess
F-->LatentProcess
J-->ObservationModel
K-->ObservationModel
LatentProcess-->E
ObservationModel-->E
E-->|sample...NUTS...| G
G-.->H
H-.->I
DataW-.->C
Loading

Closes #45

@SamuelBrand1 SamuelBrand1 self-assigned this Feb 21, 2024
@SamuelBrand1 SamuelBrand1 linked an issue Feb 21, 2024 that may be closed by this pull request
Copy link
Collaborator

@seabbs seabbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really nice I think! As discussed f2f we may move away from the NamedTuple to instead use argument splitting. Only outstanding note is that the updated diagram should also go in the README in this PR I think

@seabbs
Copy link
Collaborator

seabbs commented Feb 21, 2024

As I have caused the pain happy to handle the conflicts when #62 is merged in

@SamuelBrand1 SamuelBrand1 requested a review from seabbs February 21, 2024 21:19
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d672c2c) 100.00% compared to head (792b4bd) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #61   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          117       123    +6     
=========================================
+ Hits           117       123    +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@seabbs seabbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@seabbs seabbs merged commit 42cfdc6 into main Feb 21, 2024
5 checks passed
@seabbs seabbs deleted the 45-improve-the-prior-interface-for-make_epi_model_inference branch February 21, 2024 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve the prior interface for make_epi_model_inference
3 participants