stan-dev / stan

Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details.
https://mc-stan.org
BSD 3-Clause "New" or "Revised" License
2.61k stars 369 forks source link

Pathfinder: unexpected behavior when num_draws < num_elbo_draws #3268

Closed WardBrian closed 7 months ago

WardBrian commented 9 months ago

Summary:

Reported by @avehtari:

Requesting the number of draws to be some small number and not also changing num_elbo_draws leads to a CSV file of unexpected length. This is only the case when running single-path pathfinder or setting psis_resample=False. The number of samples returned seems to be max(num_paths*num_draws, num_paths*num_elbo_draws)

Reproducible Steps:

How many draws would you expect the following to return?

./bernoulli data file=bernoulli.data.json pathfinder \
num_psis_draws=100 num_draws=2 psis_resample=0 num_elbo_draws=3 num_paths=2

Our docs suggest the answer should be 2×2 = 4, but it is actually 2×3 = 6.

As an aside, it might be useful if cmdstan was issuing a warning when psis_resample is 0 but a non-default value was given for num_psis_draws.

Current Version:

v2.34.1