In Rstan, for ADVI, is there a way to produce ELBO and eta (step-size)?

In Rstan, I’m running ADVI on some models. The ADVI gives weird results and I would like to see the ELBO values and stepsize it took during iteration. Is there an easy way to extract these 2 things after ADVI converges in Rstan?

(I’m using the ‘vb’ function as

advi_result <- vb(rmodel, data=data, output_samples=2000, seed=123)

No easy way. The only thing that is returned is the CSV file. You could do capture.output() and then grep the resulting file.

Is there anyway in RStan to change the number of significant figures on the ELBO iterations printed to the screen?

Often I get something like -3E3 and it’s hard to tell whether there’s any progress or not due to the lack of additional digits.

Thanks!

It is hard-coded in the C++.

On a related note, is there some sort of flag parameter that we could extract that says whether or not the ADVI converged successfully? Thanks!

No. RStan has Pareto-k diagnostic to check whether the end result is a good approximation of the true posterior, but that is technically different from convergence. There is an issue to add this to C++ so that it could be made available in other interfaces. Stan’s advi implementation is not the best possible, but there is not much pressure to improve it as dynamic HMC is more accurate and likely to be also faster (see https://openreview.net/forum?id=HJggcy2NFS)