CDCgov / DynODE

CDC/CFA/Predict/Scenarios ODE Modeling Framework
Apache License 2.0
5 stars 0 forks source link

Folding IHR into config? #273

Open kokbent opened 1 month ago

kokbent commented 1 month ago

Somewhat related to #161

IHR priors and stuff are currently specified in the likelihood function directly instead of in the config json. There is room to move them into the config, although I can see some challenges there since IHR parameters can increase/decrease depending on how we feel, and the IHR models can change so it needs to be a bit flexible...

arik-shurygin commented 1 month ago

what sort of flexibility would you like to allow for? References to other parameters may be difficult due to the structure of JSON.

four independent IHR values are easy, sampling multiplier values that are independent but multiply with the other IHR's is also easy. But if we wanted something more complex than that we may need to get creative.

SamuelBrand1 commented 1 month ago

Being able to specify the priors to the model is a fairly simple way would be a really good feature.

On way of doing this would be having a restricted set of strings like beta, gamma, normal in the configuration files along with the associated hyperparameters (e.g. a, b for Beta, mean std for Normal), then you can select the model prior choice with a string match.

arik-shurygin commented 1 month ago

Being able to specify the priors to the model is a fairly simple way would be a really good feature.

On way of doing this would be having a restricted set of strings like beta, gamma, normal in the configuration files along with the associated hyperparameters (e.g. a, b for Beta, mean std for Normal), then you can select the model prior choice with a string match.

I dont think that is what Ben is asking for. We have had the ability to specify prior distributions since #81 and even before. The issue is these prior distributions are independent of one another. You can't currently declare related variables from the config e.g.:

ihr_1 = numpyro.distributions.Normal(0, 1)
ihr_2 = numpyro.deterministic(ihr_1 / 2)

you could however do something like this using config logic along with minor code changes

ihr_1= numpyro.distributions.Normal(0, 1)
ihr_2_multiplier = numpyro.distributions.Normal(0, 0.5)
# within the set_downstream_parameters() function call
ihr2 = numpyro.deterministic(ihr_2_multiplier * ihr_1)

this is all pseudocode meant for demonstration purposes.

In short: JSON does not allow natively for references to other parameters, making doing something like this quite hacky and not encouraged. This was an issue identified very early on in development but was accepted as one of the tradeoffs with using JSON config files.