Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"term_buffer = 0" leads to "# Step size = 1" in output csv #3023

Open
funko-unko opened this issue Mar 18, 2021 · 3 comments
Open

"term_buffer = 0" leads to "# Step size = 1" in output csv #3023

funko-unko opened this issue Mar 18, 2021 · 3 comments

Comments

@funko-unko
Copy link

Summary:

See title. A dense metric was used.

CSV header:

# stan_version_major = 2
# stan_version_minor = 26
# stan_version_patch = 1
# model = log_discourse_comp_model
# method = sample (Default)
#   sample
#     num_samples = 0
#     num_warmup = 150
#     save_warmup = 1
#     thin = 1 (Default)
#     adapt
#       engaged = 1 (Default)
#       gamma = 0.050000000000000003 (Default)
#       delta = 0.80000000000000004 (Default)
#       kappa = 0.75 (Default)
#       t0 = 10 (Default)
#       init_buffer = 50
#       term_buffer = 0
#       window = 100
#     algorithm = hmc (Default)
#       hmc
#         engine = nuts (Default)
#           nuts
#             max_depth = 10 (Default)
#         metric = dense_e
#         metric_file = /tmp/tmp_4y6duce/6sl8gfq4.json
#         stepsize = 1 (Default)
#         stepsize_jitter = 0 (Default)
# id = 6
# data
#   file = /tmp/tmp_4y6duce/32j_gv89.json
# init = /tmp/tmp_4y6duce/l2cfqou8.json
# random
#   seed = 123456
# output
#   file = /tmp/tmp_4y6duce/log_discourse_comp-202103181646-6-7quzdwmv.csv
#   diagnostic_file =  (Default)
#   refresh = 100 (Default)
#   sig_figs = -1 (Default)
#   profile_file = profile.csv (Default)
# stanc_version = stanc3 ea3a31b
# stancflags = 

CSV End

[...]
38.156,0.979962,0.381802,[...]
# Adaptation terminated
# Step size = 1
# Elements of inverse mass matrix:

Expected Output:

The step size should probably be different, something in the order of 0.381802.

See also this https://discourse.mc-stan.org/t/fitting-ode-models-best-efficient-practices/21018/80
Sorry for being terse.

Current Version:

v2.26.1

@mitzimorris
Copy link
Member

mitzimorris commented Mar 18, 2021

warmup windows described here: https://mc-stan.org/docs/2_26/reference-manual/hmc-algorithm-parameters.html

Lastly, the fast parameters are allowed to adapt to the final update of the slow parameters.

if this update doesn't happen, then stepsize would remain at ??? iteration 50 (+- 1)

@funko-unko
Copy link
Author

All but the first few are generally in the same order.

For a different run (same configuration, this csv is gone) we have for 48-52

0.00409287
0.00555496
0.000998799
0.00161527
0.00242704

and for the last one 0.0035995, but again

# Step size = 1

@bbbales2
Copy link
Member

I suspect the term_buffer = 0 thing is doing it.

Like the stepsize is being reset at the end of a window with the assumption that there will be another window following.

Here is where the stepsize gets reset at the end of each warmup window: https://github.com/stan-dev/stan/blob/develop/src/stan/mcmc/hmc/nuts/adapt_diag_e_nuts.hpp#L35

A lot of the adaptation logic is here https://github.com/stan-dev/stan/tree/develop/src/stan/mcmc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants