sbi icon indicating copy to clipboard operation
sbi copied to clipboard

docs: improve logging during posterior sampling

Open janfb opened this issue 10 months ago • 0 comments

At the moment our command line logging during posterior sampling is not consistent:

for NPE / direct posteriors which we usually sample using accept and reject sampling within prior bounds, we just show the number of posterior samples:

https://github.com/sbi-dev/sbi/blob/49e091fb2dc89a07585df2ea7592b14f251a8633/sbi/samplers/rejection/rejection.py#L119-L123

for MCMC based posteriors, we do

https://github.com/sbi-dev/sbi/blob/49e091fb2dc89a07585df2ea7592b14f251a8633/sbi/samplers/mcmc/slice_numpy.py#L441-L445

Problems:

  1. this is inconsistent and should have more information for the user.
  2. the logging can be confusing when using batched sampling because it just shows the number of samples (NPE, no info about the number of x in batch) or the number of chains (MCMC, no info about how many xs, how many samples per x).

see also #1388

One idea would be to have a function that builds an logging message given num samples, num x, num chains etc, and to re-use it across sampling algorithms.

janfb avatar Feb 21 '25 10:02 janfb