stan-dev / cmdstanpy

CmdStanPy is a lightweight interface to Stan for Python users which provides the necessary objects and functions to compile a Stan program and fit the model to data using CmdStan.
BSD 3-Clause "New" or "Revised" License
149 stars 67 forks source link

allow iter_warmup when adapt_engaged = False #730

Closed bob-carpenter closed 5 months ago

bob-carpenter commented 5 months ago

Summary:

In the sample() method of a model, if I set adapt_engaged = False and iter_warmup = 1000, I get this message:

ValueError: Argument "adapt_engaged" is False, cannot specify warmup iterations.

We want to allow burnin even without adapting tuning parameters. So we should be able to turn off adaptation and have a non-zero number of warmup iterations.

Current Version:

1.20

WardBrian commented 5 months ago

Huh, we're doing exactly the wrong thing here, because we also don't assert that num_warmup is nonzero if adaptation is engaged, which means CmdStan throws an unhelpful error rather than us catching it. This has been like this since before CmdStanPy 1.0!