I am trying to implement checkpointing in cmdstanpy and I want to make sure I am passing the right arguments to the next cycle. Based on these examples
and
one should pass the last interation value as init, the stepsize__ value as the step_size and turn adapt_engaged to False.
But what would be the CmdStanPy equivalent to PyStan inv_metric??
Ok, from a lot of digging, I think that cmdstanpy metric is the inv_metric equivalent.
Is it possible to calculate it from the cmdstan output.csv file?
:param metric: Specification of the mass matrix, either as a
vector consisting of the diagonal elements of the covariance
matrix ('diag' or 'diag_e') or the full covariance matrix
('dense' or 'dense_e').
If the value of the metric argument is a string other than
'diag', 'diag_e', 'dense', or 'dense_e', it must be
a valid filepath to a JSON or Rdump file which contains an entry
'inv_metric' whose value is either the diagonal vector or
the full covariance matrix.
If the value of the metric argument is a list of paths, its
length must match the number of chains and all paths must be
unique.
Also the fit object has metric and stepsizemethods.
Then you just need to unpack metric items to individual files and have a list of files.
not sure if this applies to this use case - when running multiple chains, recommended procedure is to use same seed and use chain id to advance RNG - (cf. 9 MCMC Sampling using Hamiltonian Monte Carlo | CmdStan User’s Guide, section “Running multiple chains with a specified RNG seed”)