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

Macro shorthands for sampling #11

Open
Roger-luo opened this issue Mar 9, 2018 · 1 comment
Open

Macro shorthands for sampling #11

Roger-luo opened this issue Mar 9, 2018 · 1 comment
Labels
decision need a decision help wanted Extra attention is needed sampler issue related to sampler
Milestone

Comments

@Roger-luo
Copy link
Owner

Some shorthands can be provided for samplers to simplify most declaration sampling task. This will make user's code readable and cleaner.

Currently, we have to use the following work flow to define sample tasks (SamplePlan) and proposal distribution is dispatch ed manually to other processors by @everywhere.

space = RealSpace(min=-4, max=4)
sampler = MHSampler(space)

@everywhere function normal(x::T) where T <: Real
    factor = 1 / sqrt(2 * pi)
    return factor * exp(- x^2/2)
end

plan = SamplePlan(normal, sampler)
data = sample!(plan)

By providing macros @sample could make this easier, and multi-processing's function evaluation should be done inside the macro automatically according to given worker pool. The syntax of this macro is to be decided.

@Roger-luo Roger-luo added sampler issue related to sampler decision need a decision help wanted Extra attention is needed labels Mar 9, 2018
@Roger-luo Roger-luo modified the milestones: v0.1.x, v0.1 Mar 9, 2018
@Roger-luo
Copy link
Owner Author

@GiggleLiu comments?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
decision need a decision help wanted Extra attention is needed sampler issue related to sampler
Projects
None yet
Development

No branches or pull requests

1 participant