Hello to everyone!
I had created some code on an older version of PyStan about a year ago. I wanted to run it again, but having changed computer I had to reinstall PyStan, and currently have version 3.7. After making the many necessary modifications to make the code work, I still cannot find a way to specify to the sampler the number of warmup iterations. Is this feature suppressed in the latest versions of PyStan?
I’m not sure if this is the case, but I believe the keyword for numbers of iterations has been changed between versions of interfaces before. It seems like it’s now num_warmup
according to the docs on PyStan 3.7 in the stan.fit.Fit
object.
As a personal suggestion, if you think package changed significantly that it requires some effort to relearn it, it may be a good time to try out CmdStanPy, which is a an alternative interface to Python.
Yeah, I have noticed that there are a ton of differences, they even changed the output shape of the samplers from [n_samples, dim]
to [dim, n_samples]
. I hence just decided to uninstall PyStan 3.7
and install the version I was working originally with, which was PyStan 2.9.1.
Thank you for the quick answer anyhow!
Yeah, I was caught between the switch from version 2 to version 3 as well and these updates sometimes require refactoring the code to make it work, but it’s all for the best. Once again, with CmdStanPy the good thing is that in addition to the within-Python objects the .csv files are also saved and work the same as the output generated by CmdStan, which I found very convenient compared to pickling or generating a custom .csv, so you get the best of both worlds.
1 Like
Yeah I am sure that the update is for the best, and for sure if I where to write a new code I would go trough the pain of understanding how PyStan 3.7
works, but again I had quite some code already written and was not worth it in this case. I will definitely have a look at CmdStan, thank you again!
1 Like
ArviZ InferenceData works similarly between PyStan 2/3 and CmdStanPy. I would recommend using it to access your samples.
PyStan 3 uses the same arguments as CmdStan.
Also support for 2.x is dropped and I think python 3.9 is the latest version that 2.x can be installed.
1 Like