CDCgov / CDCgov/DynODE

implement `sensitivity_analysis` helper method

Open
#393 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13
Forks
3
Avg merge
19h 43m
Merged PRs (30d)
1

Description

implement a method which can easily perform sensitivity analysis on a DynODE model by selectively leaving out one parameter of interest out of the posterior samples dictionary at a time, and rerunning the posterior predictive distribution while re-sampling the parameter of interest.

basic sketch of the interface, subject to change.

def sensitivity_analysis(simulator : Callable, posteriors : dict[str, Array], parameters_to_vary : list[str]) -> dict[str : dict[str: Array]]:
"""
perform sensitivity analysis by calling `simulator` conditioned on `posteriors` while resampling each param within `parameters_to_vary`. 
return dict[str, dict[str, Array]] with the first key mapping to the varied parameter, and the second mapping to the posterior predictive with the resampled parameters.
"""
    for param_vary in parameters_to_vary:
           dict_leave_one_out= posteriors.copy()
           del dict_leave_one_out[param_vary]
           pred = Predictive(simulator, posteriors=dict_leave_one_out)
           ...
    pass

this method would basically just run a for loop (or parallelized pmap) over the parameters_to_vary and remove each from the posteriors dictionary before passing the one-removed dict along with simulator to the numpyro.Predictive class to regenerate more posterior predictive distributions with the left-out parameter being resampled.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the simulator callable and the numpyro.Predictive usage described in the issue; no files or tests are named. Trace how posteriors and parameters_to_vary are represented, then verify that each requested parameter can be left out and resampled. Done means returning the specified nested mapping for every requested parameter.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.