stan-dev / stan

Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details.
https://mc-stan.org
BSD 3-Clause "New" or "Revised" License
2.57k stars 368 forks source link

Implement automatic selection of dense/diag metric at warmup #2814

Open bbbales2 opened 5 years ago

bbbales2 commented 5 years ago

Summary:

Implement the automatic selection between metric=dense_e and metric=diag_e as described in: https://arxiv.org/abs/1905.11916

Description

It's not always obvious when the diagonal or dense metrics are the best. Or even if it's obvious that a dense metric will be good eventually, early in warmup the proposed metrics might not be so great.

This change will, at the end of each warmup stage where the metric is recomputed, decide whether to use a dense or diagonal metric for the next warmup stage (or for the sampling) automatically.

Current Version:

v2.20.0

bob-carpenter commented 5 years ago

Is this issue for the sampler and a services function?

Could you explain where the sampler functionality will go and how the new services function will differ from our existing dense and diagonal service functions.

bbbales2 commented 5 years ago

Is this issue for the sampler and a services function?

Both and also whatever needs to happen with cmdstan.

Could you explain where the sampler functionality will go and how the new services function will differ from our existing dense and diagonal service functions.

I made a third metric option in cmdstan ('auto'). I made a new service function here: https://github.com/stan-dev/stan/blob/88225d08e30636073a310e9cc4eefc97e5212dbf/src/stan/services/sample/hmc_nuts_auto_e_adapt.hpp

To give some idea of what changed, the changed file list is:

src/stan/mcmc/auto_adaptation.hpp 
src/stan/mcmc/hmc/hamiltonians/auto_e_metric.hpp 
src/stan/mcmc/hmc/hamiltonians/auto_e_point.hpp 
src/stan/mcmc/hmc/nuts/adapt_auto_e_nuts.hpp 
src/stan/mcmc/hmc/nuts/auto_e_nuts.hpp 
src/stan/mcmc/stepsize_auto_adapter.hpp
src/stan/services/sample/hmc_nuts_auto_e_adapt.hpp