How to save the ELBO values from CmdStanModel.variational() in cmdstanpy

Hi! I am working on running advi on a LDA model. I planned to run a couple of different chains with different model seeds and select the one with the largest ELBO and check its results. However, I noticed that the argument save_diagnostics was removed from cmdstanpy 1.1.0. Are there any ways to save the ELBO’s from CmdStan fit?

Thanks!

Cmdstanpy calls this argument save_latent_dynamics (I’m not sure why, I suspect for historical reasons). This will produce the diagnostic file you desire, but I do not believe cmdstanpy provides a native way access that data, so you will most likely need to use a bit of pandas to open it and get out the information you require

Thank you for your help! It looks like the diagnostics results are saved into a file with template name modelName+[yy/mm/dd].csv. Are there any ways for me to customize the file name?

You can access the names of the file for a specific run in fit.runset.diagnostic_files, but we do not currently provide a way to specify a name in advance

Got it! Thank you so much for the help!

1 Like