CmdStan / CmdStanPy - if sampler run with `save_warmup=True` - include warmup draws by default?

CmdStanPy returns the draws from a set of sampler outputs as a 3-D array arranged draws X chains X sampler/model(params,qois) 3-D array.
I’m working on issue - which is to harmonize behavior with CmdStanR which has method draws - so changins [CmdStanMCMC object property sample]( to function draws which has argument inc_warmup which specifies whether or not to include the warmup draws.

so my question is, if you ran the sampler with argument save_warmup=True, what is the most natural way to call function draws:

  • default is to always include warmup - inc_warmup=True by default, and if save_warmup=False don’t complain
  • default is to always omit warmup - inc_warmup=False by default, and if inc_warmup=True but if sampler run had save_warmup=False, then complain

comments welcome here or via GitHub issue.

per offline discussion, there are two use cases:

  • traceplots - either on just warmup draws, or just posterior draws or both
  • inference - always only on just posterior draws

For fit$draws(inc_warmup) I think the default should always be inc_warmup=FALSE even even if save_warmup = TRUE. Even if warmup is saved I don’t think the user will want warmup draws every time they call the draws() method. Maybe just once. So I think the most convenient option in both cases is to have it default to FALSE.

In CmdStanR we error if inc_warmup=TRUE but when fitting they had save_warmup = FALSE.

1 Like

this makes sense - getting inference correct is more important than showing traceplots - although making traceplots provides a good example of how to use this feature.

1 Like