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

[Tutorial] Elliptical Slice Sampling #42

Open
yebai opened this issue Feb 13, 2022 · 6 comments
Open

[Tutorial] Elliptical Slice Sampling #42

yebai opened this issue Feb 13, 2022 · 6 comments

Comments

@yebai
Copy link
Member

yebai commented Feb 13, 2022

We should have a tutorial on comparing the ESS sampler against HMC samplers. HMC is very popular, but partially due to availability in Stan. In many interesting cases with Gaussian priors, ESS could be a competitive alternative, I think, both computationally and statistically!

cc @devmotion

@storopoli
Copy link
Member

Sure, can you point me towards a nice tutorial to emulate or documentation on ESS?

@devmotion
Copy link
Member

https://github.com/TuringLang/EllipticalSliceSampling.jl and in particular the video in the README are helpful I hope 😉

@storopoli
Copy link
Member

Thanks, will look into it.

@storopoli storopoli self-assigned this Feb 14, 2022
@devmotion
Copy link
Member

Just ask if anything is unclear or doesn't work 🙂

@storopoli storopoli changed the title Support elliptical slice sampling for inference [Tutorial] Elliptical Slice Sampling Feb 18, 2022
@rikhuijzer
Copy link
Contributor

I've tried it on the linear regression and logistic regression by adding:

ess_chn = sample(model, ESS(), 2_000);

Both give

[ESS] does only support one variable (2 variables specified)

1. error(::String)@error.jl:33
2. var"#initialstep#35"(::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::typeof(DynamicPPL.initialstep), ::Random._GLOBAL_RNG, ::DynamicPPL.Model{TuringGLM.var"#bernoulli_model#31"{Int64, Int64, TuringGLM.CustomPrior}, (:y, :X, :predictors, :μ_X, :σ_X, :prior), (:predictors, :μ_X, :σ_X, :prior), (), Tuple{SentinelArrays.ChainedVector{Int64, Vector{Int64}}, Matrix{Float64}, Int64, Int64, Int64, TuringGLM.CustomPrior}, Tuple{Int64, Int64, Int64, TuringGLM.CustomPrior}, DynamicPPL.DefaultContext}, ::DynamicPPL.Sampler{Turing.Inference.ESS{()}}, ::DynamicPPL.TypedVarInfo{NamedTuple{(:α, :β), Tuple{DynamicPPL.Metadata{Dict{AbstractPPL.VarName{:α, Setfield.IdentityLens}, Int64}, Vector{Distributions.LocationScale{Float64, Distributions.Continuous, Distributions.TDist{Float64}}}, Vector{AbstractPPL.VarName{:α, Setfield.IdentityLens}}, Vector{Float64}, Vector{Set{DynamicPPL.Selector}}}, DynamicPPL.Metadata{Dict{AbstractPPL.VarName{:β, Setfield.IdentityLens}, Int64}, Vector{Distributions.Product{Distributions.Continuous, Distributions.TDist{Float64}, FillArrays.Fill{Distributions.TDist{Float64}, 1, Tuple{Base.OneTo{Int64}}}}}, Vector{AbstractPPL.VarName{:β, Setfield.IdentityLens}}, Vector{Float64}, Vector{Set{DynamicPPL.Selector}}}}}, Float64})@ess.jl:38
3. initialstep(::Random._GLOBAL_RNG, ::DynamicPPL.Model{TuringGLM.var"#bernoulli_model#31"{Int64, Int64, TuringGLM.CustomPrior}, (:y, :X, :predictors, :μ_X, :σ_X, :prior), (:predictors, :μ_X, :σ_X, :prior), (), Tuple{SentinelArrays.ChainedVector{Int64, Vector{Int64}}, Matrix{Float64}, Int64, Int64, Int64, TuringGLM.CustomPrior}, Tuple{Int64, Int64, Int64, TuringGLM.CustomPrior}, DynamicPPL.DefaultContext}, ::DynamicPPL.Sampler{Turing.Inference.ESS{()}}, ::DynamicPPL.TypedVarInfo{NamedTuple{(:α, :β), Tuple{DynamicPPL.Metadata{Dict{AbstractPPL.VarName{:α, Setfield.IdentityLens}, Int64}, Vector{Distributions.LocationScale{Float64, Distributions.Continuous, Distributions.TDist{Float64}}}, Vector{AbstractPPL.VarName{:α, Setfield.IdentityLens}}, Vector{Float64}, Vector{Set{DynamicPPL.Selector}}}, DynamicPPL.Metadata{Dict{AbstractPPL.VarName{:β, Setfield.IdentityLens}, Int64}, Vector{Distributions.Product{Distributions.Continuous, Distributions.TDist{Float64}, FillArrays.Fill{Distributions.TDist{Float64}, 1, Tuple{Base.OneTo{Int64}}}}}, Vector{AbstractPPL.VarName{:β, Setfield.IdentityLens}}, Vector{Float64}, Vector{Set{DynamicPPL.Selector}}}}}, Float64})@ess.jl:37
4. var"#step#17"(::Nothing, ::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::typeof(AbstractMCMC.step), ::Random._GLOBAL_RNG, ::DynamicPPL.Model{TuringGLM.var"#bernoulli_model#31"{Int64, Int64, TuringGLM.CustomPrior}, (:y, :X, :predictors, :μ_X, :σ_X, :prior), (:predictors, :μ_X, :σ_X, :prior), (), Tuple{SentinelArrays.ChainedVector{Int64, Vector{Int64}}, Matrix{Float64}, Int64, Int64, Int64, TuringGLM.CustomPrior}, Tuple{Int64, Int64, Int64, TuringGLM.CustomPrior}, DynamicPPL.DefaultContext}, ::DynamicPPL.Sampler{Turing.Inference.ESS{()}})@sampler.jl:99
[email protected]:74[inlined]
6. macro [email protected]:124[inlined]
7. macro [email protected]:328[inlined]
8. macro [email protected]:8[inlined]

@devmotion
Copy link
Member

You have to use a Gibbs sampler if the variables don't have a common Gaussian prior.

@storopoli storopoli removed their assignment Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants