Iterations and warm ups in Stan

Hi all,
I am currently trying to Implement Hidden Markov Models using PyStan. I understand that Stan has a model fitting parameter as n_iter and warmups.
However, I am not able to find the meaning behind the warmups and iterations. I have trained the model and now I am getting the results for 4000 iterations.
Does this mean that last iteration produces the best result or I am missing something?



Warmup --> learn hmc parameters

Iter-warmup --> posterior draws

iter = 2000 per chain
Warmup = 1000 per chain
Draws = 1000 per chain
4 chains --> 4000 draws

1 Like

Thanks for your response.
Is there any way in Stan wherein I can check the parameters after the warmup. I mean if I want to skip the iteration step and just look at the parameters that were learned from warm up.

With current develop branch you have this option

Older pystan have textual output in fit.get_adaption_info()

Hi, thanks for the help.
However, this method still required the iteration step (even though number of iteration steps=1).
However, I am looking for the below solution:

  • No Iteration.
  • Get the trained parameters as soon as warm-up finishes.

There is a small “bug” in PyStan, so it can not be done currently. You could use CmdStan / CmdStanPy and extract metric, stepsize and last location from the generated csv / StanFit.

Are you absolutely sure you know what you’re asking for here? More expert folks could chime in to correct me, but I don’t think the final “sample” from the warmup is anything special; it’s not necessarily a sample from the typical set and certainly isn’t any sort of minimum/maximum.

For anyone else confused by this, @ahartikainen means: “iter minus warmup”. It’s clear in the numbers, but I was looking for a parameter named iter-warmup!

1 Like