Expected Coverage in TSNPE #1411
Closed
hoangdzung
started this conversation in
General
Replies: 2 comments
-
Hi there, the snippet above does not include the computation of expected coverage. To compute it, run from sbi.diagnostics import run_sbc
from sbi.analysis.plot import sbc_rank_plot
num_sbc_samples = 200 # choose a number of sbc runs, should be ~100s
# generate ground truth parameters and corresponding simulated observations for SBC.
thetas = prior.sample((num_sbc_samples,))
xs = simulator(thetas)
# run SBC: for each inference we draw 1000 posterior samples.
num_posterior_samples = 1_000
num_workers = 1
ranks, dap_samples = run_sbc(
thetas,
xs,
posterior,
num_posterior_samples=num_posterior_samples,
num_workers=num_workers,
reduce_fns=posterior.log_prob,
)
f, ax = sbc_rank_plot(ranks, 1_000, plot_type="cdf") Note that this diagnostic is only correct after the first round of TSNPE. Later rounds will require truncation of the posterior For more background on diagnostics, see this tutorial on SBC. And yes, Hope that helps |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks a lot for your quick and helpful reply. I will check this out. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
I am currently working with TSNPE and using the following code snippet from the tutorial:
I would like to understand where the expected coverage (Algorithm 2 in the paper) is computed in the code. Could you point me to the relevant implementation or function that handles this?
Is there any automated mechanism that performs early stopping?
Thank you for your time!
Beta Was this translation helpful? Give feedback.
All reactions