Variational number of samples + on non-convergence where do samples come from?

105 views
Skip to first unread message

John Reid

unread,
Nov 2, 2015, 9:49:13 AM11/2/15
to Stan users mailing list
When I ask for 200 samples in the variational command line I get 201 samples back with the first looking like an outlier. Can anyone let me know where this extra sample is coming from? Am I misinterpreting the output? My command line looks like:

../inst/Stan/MTKL variational output_samples=200 tol_rel_obj=0.01 iter=3500 data file=MTKL_data.R

Also when I reach the maximum iterations without convergence, do the samples come from the final iteration or the one with best ELBO?

Thanks,
John.

Dustin Tran

unread,
Nov 2, 2015, 10:56:54 AM11/2/15
to stan-...@googlegroups.com
hi john,

the first “sample" is the mean set of parameters outputted by the variational distribution. it is not meant to be used as a sample but as a quick summary statistic of the distribution. you can find more in the manual in cmdstan—hope that helps

dustin
--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
To post to this group, send email to stan-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John Reid

unread,
Nov 2, 2015, 11:21:26 AM11/2/15
to Stan users mailing list
Yes that does help, I found that now in the manual. I suppose that in the mean field case that first line represents all the information about the inference. I.e. the rest of the samples are just samples from those parameters.

Dustin Tran

unread,
Nov 2, 2015, 11:30:42 AM11/2/15
to stan-...@googlegroups.com
it outputs the mean of the parameters, but variational parameters such as the standard deviation for the normals are not outputted. so that line doesn’t fully characterize the (variational) distribution.

dustin

John Reid

unread,
Nov 2, 2015, 11:55:44 AM11/2/15
to stan-...@googlegroups.com
Good point. If the algorithm does not converge from which iteration are the samples taken?
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/H0DA8dNCBx8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+...@googlegroups.com.

Alp Kucukelbir

unread,
Nov 2, 2015, 12:26:48 PM11/2/15
to Stan users mailing list
hi john,

if the algorithm does not converge, the samples are taken from the last (maximum) iteration.

cheers,
alp

Bob Carpenter

unread,
Nov 2, 2015, 12:39:47 PM11/2/15
to stan-...@googlegroups.com
I think the sample file that's output from variational inference
should match the one output for MCMC if at all possible.

Would it be possible to take that summary of means and write it
out as a comment? Or in a separate output file?

Going forward, we're going to split the outputs in Stan 3 (if
I get my way) so that we don't try to overload CSV notation with
out-of-encoding comment information that needs to be parsed, which
is too hard to deal with other than with our own I/O tools (which
themselves become hard to maintain).

- Bob

Dustin Tran

unread,
Nov 2, 2015, 1:26:49 PM11/2/15
to stan-...@googlegroups.com
sure, i added it as an issue on github: https://github.com/stan-dev/stan/issues/1661

Dustin

John Reid

unread,
Nov 3, 2015, 4:40:30 AM11/3/15
to stan-...@googlegroups.com
Hi Alp,
Does it make more sense to take them from the iteration with the best ELBO?
Cheers, John.

John Reid

unread,
Nov 3, 2015, 5:31:02 AM11/3/15
to stan-...@googlegroups.com
Also would it be possible to have cmdstan output samples from the best iteration so far if it is interrupted (Ctrl-C)?

Alp Kucukelbir

unread,
Nov 3, 2015, 6:53:25 AM11/3/15
to stan-...@googlegroups.com
hi john,

i would vote against this for two reasons: 1) the ELBO really should
be increasing throughout the optimization and 2) our evaluation of the
ELBO itself is stochastic (noisy). therefore, taking samples from the
iteration with the best ELBO may not be reliable at all.

cheers
alp

Alp Kucukelbir

unread,
Nov 3, 2015, 6:54:50 AM11/3/15
to stan-...@googlegroups.com
this is definitely something we should look into:

https://github.com/stan-dev/stan/issues/1663

Andrew Gelman

unread,
Nov 3, 2015, 7:53:52 PM11/3/15
to stan-...@googlegroups.com
I agree. To put it another way: early stopping can be a good strategy, but if so we should think about it as a strategy rather than just picking an intermediate step in that way.
Reply all
Reply to author
Forward
0 new messages