Skip to content

Commit

Permalink
Change the default emcee moves based on a test with an influenza mode…
Browse files Browse the repository at this point in the history
…l for the US (#96)
  • Loading branch information
twallema authored Sep 26, 2024
1 parent 8c3b36d commit 6119400
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/optimization.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
> * **settings_dict** (dict) - optional - Dictionary containing calibration settings or other usefull settings for long-term storage. Saved in `.json` format. Appended to the samples dictionary generated by `emcee_sampler_to_dictionary()`.
> **Hyperparameters:**
> * **moves** (list) - optional - Algorithm used for updating the coordinates of walkers in an ensemble sampler. By default, pySODM uses a differential evolution move 25% of the time, a differential evolution snooker move 25% of the time, and a kernel-density estimate move 50% of the time. Consult the [emcee documentation](https://emcee.readthedocs.io/en/stable/user/moves/) for an overview of all moves.
> * **moves** (list) - optional - Algorithm used for updating the coordinates of walkers in an ensemble sampler. By default, pySODM uses a shotgun approach by implementing a balanced cocktail of `emcee` moves. Consult the [emcee documentation](https://emcee.readthedocs.io/en/stable/user/moves/) for an overview of all moves.
> * **backend** (`emcee.backends.HDFBackend`) - optional - Backend of a previous sampling experiment. If a backend is provided, the sampler is restarted from the last iteration of the previous run. Consult the [emcee documentation](https://emcee.readthedocs.io/en/stable/user/backends/).
> * **progress** (bool) - optional - Enables the progress bar.
Expand Down
6 changes: 4 additions & 2 deletions src/pySODM/optimization/mcmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
abs_dir = os.path.dirname(__file__)

def run_EnsembleSampler(pos, max_n, identifier, objective_function, objective_function_args=None, objective_function_kwargs=None,
moves=[(emcee.moves.DEMove(), 0.25),(emcee.moves.DESnookerMove(),0.25),(emcee.moves.KDEMove(bw_method='scott'), 0.50)],
moves=[(emcee.moves.DEMove(), 0.5*0.5*0.9),(emcee.moves.DEMove(gamma0=1.0),0.5*0.5*0.1),
(emcee.moves.DESnookerMove(),0.5*0.5),(emcee.moves.KDEMove(bw_method='scott'), 0.25),
(emcee.moves.StretchMove(live_dangerously=True), 0.25)],
fig_path=None, samples_path=None, print_n=10, backend=None, processes=1, progress=True, settings_dict={}):
"""Wrapper function to setup an `emcee.EnsembleSampler` and handle all backend-related tasks.
Expand Down Expand Up @@ -42,7 +44,7 @@ def run_EnsembleSampler(pos, max_n, identifier, objective_function, objective_fu
Hyperparameters:
----------------
moves: list
Algorithm used for updating the coordinates of walkers in an ensemble sampler. By default, pySODM uses a differential evolution move 25% of the time, a differential evolution snooker move 25% of the time, and a kernel-density estimate move 50% of the time. Consult the [emcee documentation](https://emcee.readthedocs.io/en/stable/user/moves/).
Algorithm used for updating the coordinates of walkers in an ensemble sampler. By default, pySODM uses a shotgun approach by implementing a balanced cocktail of `emcee` moves. Consult the [emcee documentation](https://emcee.readthedocs.io/en/stable/user/moves/).
backend: emcee.backends.HDFBackend
Backend of a previous sampling experiment. If a backend is provided, the sampler is restarted from the last iteration of the previous run. Consult the [emcee documentation](https://emcee.readthedocs.io/en/stable/user/backends/).
progress: bool
Expand Down

0 comments on commit 6119400

Please sign in to comment.