Skip to content

Add some interface functions to support the new Gibbs sampler in Turing #282

Add some interface functions to support the new Gibbs sampler in Turing

Add some interface functions to support the new Gibbs sampler in Turing #282

Triggered via pull request October 1, 2024 17:37
Status Failure
Total duration 2m 54s
Artifacts

Docs.yml

on: pull_request
Fit to window
Zoom out
Zoom in

Annotations

4 errors, 2 warnings, and 1 notice
build: ../../../.julia/packages/Documenter/C1XEF/src/utilities/utilities.jl#L44
failed to run `@example` block in src/state_interface.md:187-271 ```@example gibbs_example """ RandomWalkMH{T} <: AbstractMCMC.AbstractSampler A random walk Metropolis-Hastings sampler with a normal proposal distribution. The field σ is the standard deviation of the proposal distribution. """ struct RandomWalkMH{T} <: AbstractMHSampler σ::T end """ IndependentMH{T} <: AbstractMCMC.AbstractSampler A Metropolis-Hastings sampler with an independent proposal distribution. """ struct IndependentMH{T} <: AbstractMHSampler proposal_dist::T end # the first step of the sampler function AbstractMCMC.step( rng::AbstractRNG, logdensity_model::AbstractMCMC.LogDensityModel, sampler::AbstractMHSampler, args...; initial_params, kwargs..., ) logdensity_function = logdensity_model.logdensity transition = MHTransition(initial_params) state = MHState( initial_params, only(LogDensityProblems.logdensity(logdensity_function, initial_params)), ) return transition, state end @inline get_proposal_dist(sampler::RandomWalkMH, current_params::Vector{Float64}) = MvNormal(current_params, sampler.σ) @inline get_proposal_dist(sampler::IndependentMH, current_params::Vector{T}) where {T} = sampler.proposal_dist # the subsequent steps of the sampler function AbstractMCMC.step( rng::AbstractRNG, logdensity_model::AbstractMCMC.LogDensityModel, sampler::AbstractMHSampler, state::MHState, args...; kwargs..., ) logdensity_function = logdensity_model.logdensity current_params = state.params proposal_dist = get_proposal_dist(sampler, current_params) proposed_params = rand(rng, proposal_dist) logp_proposal = only( LogDensityProblems.logdensity(logdensity_function, proposed_params) ) if log(rand(rng)) < compute_log_acceptance_ratio(sampler, state, proposed_params, logp_proposal) return MHTransition(proposed_params), MHState(proposed_params, logp_proposal) else return MHTransition(current_params), MHState(current_params, state.logp) end end function compute_log_acceptance_ratio( ::RandomWalkMH, state::MHState, ::Vector{Float64}, logp_proposal::Float64 ) return min(0, logp_proposal - state.logp) end function compute_log_acceptance_ratio( sampler::IndependentMH, state::MHState, proposal::Vector{T}, logp_proposal::Float64 ) where {T} return min( 0, logp_proposal - state.logp + logpdf(sampler.proposal_dist, state.params) - logpdf(sampler.proposal_dist, proposal), ) end ``` exception = UndefVarError: `AbstractMHSampler` not defined Stacktrace: [1] top-level scope @ state_interface.md:188 [2] eval @ ./boot.jl:385 [inlined] [3] #60 @ ~/.julia/packages/Documenter/C1XEF/src/expander_pipeline.jl:754 [inlined] [4] cd(f::Documenter.var"#60#62"{Module, Expr}, dir::String) @ Base.Filesystem ./file.jl:112 [5] (::Documenter.var"#59#61"{Documenter.Page, Module, Expr})() @ Documenter ~/.julia/packages/Documenter/C1XEF/src/expander_pipeline.jl:753 [6] (::IOCapture.var"#5#9"{DataType, Documenter.var"#59#61"{Documenter.Page, Module, Expr}, IOContext{Base.PipeEndpoint}, IOContext{Base.PipeEndpoint}, IOContext{Base.PipeEndpoint}, IOContext{Base.PipeEndpoint}})() @ IOCapture ~/.julia/packages/IOCapture/Y5rEA/src/IOCapture.jl:170 [7] with_logstate(f::Function, logstate::Any) @ Base.CoreLogging ./logging.jl:515 [8] with_logger @ ./logging.jl:627 [inlined] [9] capture(f::Documenter.var"#59#61"{Documenter.Page, Module, Expr}; rethrow::Type, color::Bool, passthrough::Bool, capture_buffer::IOBuffer, io_context::Vector{Any}) @ IOCapture ~/.julia/packages/IOCapture/Y5rEA/src/IOCapture.jl:167 [10] runner(::Type{Documenter.Expanders.ExampleBlocks}, node::MarkdownAST.Node{Nothing}, page::Documenter.Page, doc::Documenter.Document) @ Documenter ~/.julia/packages/Documenter/C1XEF/src/expander_pipeline.jl:752
build: ../../../.julia/packages/Documenter/C1XEF/src/utilities/utilities.jl#L44
failed to run `@example` block in src/state_interface.md:480-490 ```@example gibbs_example samples = sample( hn, Gibbs(( mu=RandomWalkMH(0.3), tau2=IndependentMH(product_distribution([InverseGamma(1, 1)])), )), 10000; initial_params=(mu=[0.0], tau2=[1.0]), ) ``` exception = UndefVarError: `RandomWalkMH` not defined Stacktrace: [1] top-level scope @ state_interface.md:481 [2] eval @ ./boot.jl:385 [inlined] [3] #60 @ ~/.julia/packages/Documenter/C1XEF/src/expander_pipeline.jl:754 [inlined] [4] cd(f::Documenter.var"#60#62"{Module, Expr}, dir::String) @ Base.Filesystem ./file.jl:112 [5] (::Documenter.var"#59#61"{Documenter.Page, Module, Expr})() @ Documenter ~/.julia/packages/Documenter/C1XEF/src/expander_pipeline.jl:753 [6] (::IOCapture.var"#5#9"{DataType, Documenter.var"#59#61"{Documenter.Page, Module, Expr}, IOContext{Base.PipeEndpoint}, IOContext{Base.PipeEndpoint}, IOContext{Base.PipeEndpoint}, IOContext{Base.PipeEndpoint}})() @ IOCapture ~/.julia/packages/IOCapture/Y5rEA/src/IOCapture.jl:170 [7] with_logstate(f::Function, logstate::Any) @ Base.CoreLogging ./logging.jl:515 [8] with_logger @ ./logging.jl:627 [inlined] [9] capture(f::Documenter.var"#59#61"{Documenter.Page, Module, Expr}; rethrow::Type, color::Bool, passthrough::Bool, capture_buffer::IOBuffer, io_context::Vector{Any}) @ IOCapture ~/.julia/packages/IOCapture/Y5rEA/src/IOCapture.jl:167 [10] runner(::Type{Documenter.Expanders.ExampleBlocks}, node::MarkdownAST.Node{Nothing}, page::Documenter.Page, doc::Documenter.Document) @ Documenter ~/.julia/packages/Documenter/C1XEF/src/expander_pipeline.jl:752
build: ../../../.julia/packages/Documenter/C1XEF/src/utilities/utilities.jl#L44
failed to run `@example` block in src/state_interface.md:494-504 ```@example gibbs_example warmup = 5000 thin = 10 thinned_samples = samples[(warmup + 1):thin:end] mu_samples = [sample.values.mu for sample in thinned_samples] tau2_samples = [sample.values.tau2 for sample in thinned_samples] mu_mean = only(mean(mu_samples)) tau2_mean = only(mean(tau2_samples)) (mu_mean, tau2_mean) ``` exception = UndefVarError: `samples` not defined Stacktrace: [1] top-level scope @ state_interface.md:497 [2] eval @ ./boot.jl:385 [inlined] [3] #60 @ ~/.julia/packages/Documenter/C1XEF/src/expander_pipeline.jl:754 [inlined] [4] cd(f::Documenter.var"#60#62"{Module, Expr}, dir::String) @ Base.Filesystem ./file.jl:112 [5] (::Documenter.var"#59#61"{Documenter.Page, Module, Expr})() @ Documenter ~/.julia/packages/Documenter/C1XEF/src/expander_pipeline.jl:753 [6] (::IOCapture.var"#5#9"{DataType, Documenter.var"#59#61"{Documenter.Page, Module, Expr}, IOContext{Base.PipeEndpoint}, IOContext{Base.PipeEndpoint}, IOContext{Base.PipeEndpoint}, IOContext{Base.PipeEndpoint}})() @ IOCapture ~/.julia/packages/IOCapture/Y5rEA/src/IOCapture.jl:170 [7] with_logstate(f::Function, logstate::Any) @ Base.CoreLogging ./logging.jl:515 [8] with_logger @ ./logging.jl:627 [inlined] [9] capture(f::Documenter.var"#59#61"{Documenter.Page, Module, Expr}; rethrow::Type, color::Bool, passthrough::Bool, capture_buffer::IOBuffer, io_context::Vector{Any}) @ IOCapture ~/.julia/packages/IOCapture/Y5rEA/src/IOCapture.jl:167 [10] runner(::Type{Documenter.Expanders.ExampleBlocks}, node::MarkdownAST.Node{Nothing}, page::Documenter.Page, doc::Documenter.Document) @ Documenter ~/.julia/packages/Documenter/C1XEF/src/expander_pipeline.jl:752
build
Process completed with exit code 1.
build
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
build
The following actions use a deprecated Node.js version and will be forced to run on node20: actions/checkout@v2, julia-actions/setup-julia@v1. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
[julia-buildpkg] Caching of the julia depot was not detected
Consider using `julia-actions/cache` to speed up runs https://github.com/julia-actions/cache. To ignore, set input `ignore-no-cache: true`