sbi icon indicating copy to clipboard operation
sbi copied to clipboard

One prior for each of the parameters

Open jecampagne opened this issue 3 years ago • 2 comments

Hi, Sorry, may be I missed something in the doc but let me describe a use-case. In a generic scenario some of the parameters (theta) that are inputs of the simulator, can have been roughly estimated by other experiments. So let us say that we have 3 parameters (theta1, theta2, theta3), it may be possible that we get 3 different priors as:

  • theta1: Uniform(low=0.4, high=1.0)
  • theta2: Uniform(low=0.03, high0.07)
  • theta3: Normal(mu=0.012, sigma=0.023)

How should I code this in a unified prior to be used in one of the SNPE/SNLE/SNRE methods? Thanks

jecampagne avatar Oct 14 '22 07:10 jecampagne

Hi, you can pass the priors in a list to process_prior([prior1, prior2, ...]) (import with from sbi.utils import process_prior) and will get back a MultipleIndepenent prior.

janfb avatar Oct 14 '22 07:10 janfb

Ha! nice, I was sure that you had though about this kind of scenario. Thanks.

jecampagne avatar Oct 14 '22 07:10 jecampagne

Sorry to reopen, I have 3 independents priors

prior = process_prior([prior_oc, prior_s8, prior_w0] )

leading to (MultipleIndependent(), 3, False) , ok but what about this error,

#adapt/check the prior & simulator for SBI
simulator, prior = prepare_for_sbi(simulator, prior)
AssertionError: Nesting of combined distributions is not possible.

how should I proceed? Thanks

jecampagne avatar Oct 21 '22 12:10 jecampagne

@jecampagne, here's an explanation in a different issue: https://github.com/mackelab/sbi/issues/752#issuecomment-1288176671

musoke avatar Feb 28 '23 20:02 musoke