You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Replace prepare_for_sbi with separate calls to for prior and simulator in all tutorials #752
Hi, no need to run prepare_for_sbi after you have run process_prior. You can simply pass a dummy to prepare_for_sbi if you only want to prepare your simulator:
I agree that this is not elegant and we should probably split prepare_for_sbi into separate functions for the prior and the simulator, so let's keep this issue open until this is implemented
changed the title [-]Related to #746: prepare_for_sbi with process_prior[/-][+]Split `prepare_for_sbi` into separate functions for prior and simulator[/+]on Oct 23, 2022
Regarding the error: it seems one of your priors was already processed to be a MultipleIndependent. The priors passed as list should all the native torch.distributions, e.g., Uniform, MultivariateNormal etc.
Regarding splitting prepare_for_sbi: What Michael said :) prepare_for_sbi is just a wrapper that calls process_prior and process_simulator. process_simulator checks the return type and ensures that the simulator returns a batch dimension. process_prior returns a tuple (processed_prior, num_parametes, whether_the_prior_returns_numpy). Thus, when using it, make sure to pass on only the processed prior, not the entire tuple.
as discussed, we will promote using process_prior and process_simulator separately instead of using prepare_for_sbi, e.g., by changing it in all the tutorials:
replace simulator, prior = prepare_for_sbi(custom_simulator, custom_prior)
by
changed the title [-]Split `prepare_for_sbi` into separate functions for prior and simulator[/-][+]Replace `prepare_for_sbi` with separate calls to for prior and simulator in all tutorials[/+]on Nov 9, 2022
Activity
[-]Related to #746[/-][+]Related to #746: prepare_for_sbi with process_prior[/+]michaeldeistler commentedon Oct 23, 2022
Hi, no need to run
prepare_for_sbiafter you have runprocess_prior. You can simply pass a dummy toprepare_for_sbiif you only want to prepare your simulator:michaeldeistler commentedon Oct 23, 2022
I agree that this is not elegant and we should probably split
prepare_for_sbiinto separate functions for the prior and the simulator, so let's keep this issue open until this is implemented[-]Related to #746: prepare_for_sbi with process_prior[/-][+]Split `prepare_for_sbi` into separate functions for prior and simulator[/+]janfb commentedon Oct 24, 2022
Hey!
Regarding the API it should be possible to directly use
prepare_for_sbi:Regarding the error: it seems one of your priors was already processed to be a
MultipleIndependent. The priors passed as list should all the nativetorch.distributions, e.g.,Uniform,MultivariateNormaletc.Regarding splitting
prepare_for_sbi: What Michael said :)prepare_for_sbiis just a wrapper that callsprocess_priorandprocess_simulator.process_simulatorchecks the return type and ensures that the simulator returns a batch dimension.process_priorreturns a tuple(processed_prior, num_parametes, whether_the_prior_returns_numpy). Thus, when using it, make sure to pass on only the processed prior, not the entire tuple.janfb commentedon Oct 28, 2022
Hi, is this solved?
michaeldeistler commentedon Oct 28, 2022
I would keep it open because I think we should really split
prepare_for_sbi.janfb commentedon Nov 9, 2022
as discussed, we will promote using
process_priorandprocess_simulatorseparately instead of usingprepare_for_sbi, e.g., by changing it in all the tutorials:replace
simulator, prior = prepare_for_sbi(custom_simulator, custom_prior)by
[-]Split `prepare_for_sbi` into separate functions for prior and simulator[/-][+]Replace `prepare_for_sbi` with separate calls to for prior and simulator in all tutorials[/+]jsvetter commentedon Mar 5, 2024
TODO for the hackathon:
As described by @janfb above, this issue is not concerned with the core codebase, but only with the tutorial notebooks.
tutorialfolder and indentify the relevant onessimulator, prior = prepare_for_sbi(custom_simulator, custom_prior)byzinaStef commentedon Mar 14, 2024
Happy to take care of it.