Working with pre-simulated data #1270
-
Hi there, I was looking for some guidance to work with pre-simulated data. Is there by any chance some documentation or a tutorial available on that? Thanks, Folgert |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
See here, you can just load |
Beta Was this translation helpful? Give feedback.
-
Of course, I see! I guess my main issue was with inference = NPE(prior=prior)
inference = inference.append_simulations(theta, x) doesn't work, am I right? The most straightforward solution would then to write a custom training loop. Something like: for i in range(iterations):
theta, x = get_data_batch(i) # or something like that
optimizer.zero_grad()
losses = inference.loss(theta, condition=x)
loss = torch.mean(losses)
loss.backward()
optimizer.step() |
Beta Was this translation helpful? Give feedback.
See here, you can just load
theta
andx
from disk instead of generating them withtheta, x = simulate_for_sbi(simulator, proposal=prior, num_simulations=2000)