Skip to content

Improve sampling speed for SNLE/SNRE #913

Answered by michaeldeistler
Saheli2001 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi you can either use other sampling methods (variational inference or rejection sampling) or you customize MCMC to improve sampling speed. See also here.

  1. Use VI:
inference = SNLE(prior)
_ = inference.append_simulations(theta, x).train()

sampling_algorithm = "vi"
vi_method = "rKL"  # or fKL
posterior = inference.build_posterior(sample_with=sampling_algorithm, vi_method=vi_method)

# Unlike other methods, vi needs a training step for every observation.
posterior = posterior.set_default_x(x_o).train()
  1. Use rejection sampling
# Sampling with rejection sampling
sampling_algorithm = "rejection"
posterior = inference.build_posterior(sample_with=sampling_algorithm)
  1. Customize MCMC. Use more …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Saheli2001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants