Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split up simulations if necessary #47

Closed
mstimberg opened this issue May 26, 2021 · 2 comments
Closed

Split up simulations if necessary #47

mstimberg opened this issue May 26, 2021 · 2 comments

Comments

@mstimberg
Copy link
Member

The first stages of the process detailed in #44 might potentially have to simulate a large number of samples, too big to fit into memory as part of a single simulation. As a first step, we might simply let the user deal with this (e.g. by calling something like inferencer.simulate(n_samples=10_000) repeatedly). A fancier solution would be to ask the user for the maximum memory that the simulation should use, estimate the memory usage of the monitors and split up the simulation accordingly. Even more automatic (but maybe too automatic/too complicated to get right on all platforms?) would be to look at the actual memory available.

@mstimberg mstimberg added this to To do in sbi integration (GSoC 2021) via automation May 26, 2021
@akapet00 akapet00 moved this from To do to In progress in sbi integration (GSoC 2021) Jul 15, 2021
@akapet00
Copy link
Member

I think that could be considered accidentally solved 😄
...at least w.r.t. this less fancy approach mentioned.
By allowing the user to separate infer process from data generation, the user can generate data in chunks:

inferencer = Inferencer(...)
n_samples = ...
prior = ...
theta = generate_training_data(n_samples, prior)
chunk_size = ...
x_1 = extract_summary_statistics(theta[:chunk_size, :])
x_2 = extract_summary_statistics(theta[chunk_size:chunk_size*2, :])
#  and so on, or just use for loop in some cool manner
x = vstack((x_1, x_2, ...))

Once the data are generated the user can continue with inference normally.

@mstimberg
Copy link
Member Author

Yes, I agree! I think this is good enough for now – if this appears to be a hurdle later on, we can always think of a more automatic mechanism. We should probably mention the approach in the documentation, though.

sbi integration (GSoC 2021) automation moved this from In progress to Done Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants