INFO:cmdstanpy:Install directory: /root/.cmdstanpy
INFO:cmdstanpy:Downloading CmdStan version 2.26.1
INFO:cmdstanpy:Download successful, file: /tmp/tmplpsqqk0x
INFO:cmdstanpy:Unpacked download as cmdstan-2.26.1
True
0.9.5
I then have no problem fitting my model, and I get a fit object:
type(fit)
cmdstanpy.stanfit.CmdStanMCMC
I used to run fit.draws_pd(['epsilon_steps']) but this and everything else I’ve tried from the documentation (e.g. fit.draws() and fit.draws_as_dataframe()) don’t work.
I don’t know exactly how cmdstanpy has evolved with each version, but you have 0.9.5 installed based on the output you posted and are using the docs for 0.9.65 based on the link you shared. I would recommend updating cmdstanpy. I believe you can do that in colab with !pip install -U cmdstanpy
Alternatively, using arviz.from_cmdstanpy may still work with 0.9.5 (I know it works on latest cmdstanpy, not sure about older versions) so you can get an InferenceData that can afterwards be converted to an array, dataframe or used as is.
I still can’t get draws, does the documentation say how ? fit.draws() seems to work but not sure how to specify particular parameters…? I tried guessing fit.draws('epsilon_steps') but get TypeError: draws() takes 1 positional argument but 2 were given.
just repeating what Ari said above, because it’s very clear and we will put this front and center in the CmdStanPy docs.
this is a valuable lesson for me, w/r/t the futility of trying to find good names for things.
the problem is really dealing with structured data in a 2-D, i.e., tabular/dataframe/tidy/database/flatland world
when you run a bunch of chains, the per-chain structure is needed to assess convergence and effective sample size; but if you have good convergence and proper ESS, then you just want the draws.
the draws method returns either draws by chains or flattened draws.
if you have a structured variable, i.e., vector, matrix, array of scalars, vectors, or matrices, we need convenience methods which return that variable with its structure, hence stan_variable and stan_variables. the intent is to make it easier to manipulate the variable, instead of having to deal with dataframe column names. but maybe this isn’t that useful.