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

Better adaptation configuration interface #491

Closed
xukai92 opened this issue Sep 4, 2018 · 7 comments
Closed

Better adaptation configuration interface #491

xukai92 opened this issue Sep 4, 2018 · 7 comments
Milestone

Comments

@xukai92
Copy link
Member

xukai92 commented Sep 4, 2018

Related:
#448
#485 (comment)

@yebai
Copy link
Member

yebai commented Sep 4, 2018

Another related issue: #447

@yebai
Copy link
Member

yebai commented Sep 4, 2018

@mohamed82008 can you give this a try?

@trappmartin
Copy link
Member

This might also be related #482

@yebai yebai added this to the 0.5 milestone Sep 4, 2018
@yebai
Copy link
Member

yebai commented Sep 4, 2018

Perhaps @xukai92 can post a set of design goals for this issue.

@mohamed82008
Copy link
Member

mohamed82008 commented Sep 4, 2018

The current signature of sample is:

function sample(model::Function, alg::T;
                                chunk_size=CHUNKSIZE,               # set temporary chunk size
                                save_state=false,                   # flag for state saving
                                resume_from=nothing,                # chain to continue
                                reuse_spl_n=0,                      # flag for spl re-using
                                adapt_conf=STAN_DEFAULT_ADAPT_CONF  # adapt configuration
                               ) where T<:Hamiltonian

from

function sample(model::Function, alg::T;
.

The parameter adapt_conf is passed as the second argument to Sampler so that's the warmup sample size according to #448 (comment). This is already available as a kwarg but the name may be obscure.

Other sample functions are:

sample(model::Function, alg::IPMCMC) = begin

sample(model::Function, alg::Gibbs;

sample(model::Function, alg::IS) = begin

function sample(model::Function, alg::MH;

sample(model::Function, alg::PG;

sample(model::Function, alg::PMMH;

function sample(model::Function, alg::SMC)

sample(mf::T, ss::Stan.Sample) where {T<:Function} = sample(mf, ss.num_samples, ss.num_warmup, ss.save_warmup, ss.thin, ss.adapt, ss.alg)

With the exception of the last one, all take model and alg as the first 2 arguments. But not all have the same kwargs. I will see how I can improve the interface. Hints are welcome!

@yebai
Copy link
Member

yebai commented Sep 4, 2018

Hi @mohamed82008, thanks for looking into this. The main goals of this issue are

  • Implement our own Adapt and Hmc related types. Turing currently re-uses the ones from Stan.jl, which can be found here

  • Clean up the WarnUpManager type (code). Perhaps merge with type Adapt.

  • Clean up the sample function so that they have consistent keyword arguments.

@yebai
Copy link
Member

yebai commented Sep 18, 2019

Closed by #793

@yebai yebai closed this as completed Sep 18, 2019
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

4 participants