Sleek implementations of the ZigZag, Boomerang and other assorted piecewise deterministic Markov processes for Markov Chain Monte Carlo including Sticky PDMPs for variable selection
MIT License
100
stars
7
forks
source link
Turing example broken with MethodError on whiten() #122
however, this calls whiten() in PDMats with a scalar value (F.U defined directly as0.0 # ignored in the example when instantiating the B. Particle)
I couldn't find any whiten definion in PDMats that would accept a scalar (and I cannot imagine what it would mean), so is it perhaps that the API has changed and shortcut similar to this should be defined?
Error trace:
julia> el = @elapsed begin
trace, final, (acc, num), cs = @time pdmp(
dneglogp, # return first two directional derivatives of negative target log-likelihood in direction v
∇neglogp!, # return gradient of negative target log-likelihood
t0, x0, θ0, T, # initial state and duration
ZZB.LocalBound(c), # use Hessian information
Z; # sampler
adapt=true, # adapt bound c
progress=true, # show progress bar
subsample=true # keep only samples at refreshment times
)
end
ERROR: MethodError: no method matching whiten(::Float64, ::Vector{Float64})
Closest candidates are:
whiten(::AbstractMatrix, ::AbstractVecOrMat) at ~/.julia/packages/PDMats/ZW0lN/src/generics.jl:75
Stacktrace:
[1] record_rate(θ::Vector{Float64}, F::BouncyParticle{Nothing, Nothing, Float64, Float64, Diagonal{Float64, Vector{Float64}}})
@ ZigZagBoomerang ~/.julia/packages/ZigZagBoomerang/BNuRn/src/not_fact_samplers.jl:197
[2] pdmp(::var"#139#143"{Turing.LogDensityFunction{DynamicPPL.TypedVarInfo{NamedTuple{(:α, :β), Tuple{DynamicPPL.Metadata{Dict{AbstractPPL.VarName{:α, Setfield.IdentityLens}, Int64}, Vector{Normal{Float64}}, Vector{AbstractPPL.VarName{:α, Setfield.IdentityLens}}, Vector{Float64}, Vector{Set{DynamicPPL.Selector}}}, DynamicPPL.Metadata{Dict{AbstractPPL.VarName{:β, Setfield.IdentityLens}, Int64}, Vector{DiagNormal}, Vector{AbstractPPL.VarName{:β, Setfield.IdentityLens}}, Vector{Float64}, Vector{Set{DynamicPPL.Selector}}}}}, Float64}, DynamicPPL.Model{typeof(lr_nuts), (:x, :y, :σ), (), (), Tuple{Matrix{Float64}, Vector{Float64}, Float64}, Tuple{}, DynamicPPL.DefaultContext}, DynamicPPL.SampleFromPrior, Turing.ModeEstimation.OptimizationContext{DynamicPPL.DefaultContext}}}, ::var"#141#145"{Turing.LogDensityFunction{DynamicPPL.TypedVarInfo{NamedTuple{(:α, :β), Tuple{DynamicPPL.Metadata{Dict{AbstractPPL.VarName{:α, Setfield.IdentityLens}, Int64}, Vector{Normal{Float64}}, Vector{AbstractPPL.VarName{:α, Setfield.IdentityLens}}, Vector{Float64}, Vector{Set{DynamicPPL.Selector}}}, DynamicPPL.Metadata{Dict{AbstractPPL.VarName{:β, Setfield.IdentityLens}, Int64}, Vector{DiagNormal}, Vector{AbstractPPL.VarName{:β, Setfield.IdentityLens}}, Vector{Float64}, Vector{Set{DynamicPPL.Selector}}}}}, Float64}, DynamicPPL.Model{typeof(lr_nuts), (:x, :y, :σ), (), (), Tuple{Matrix{Float64}, Vector{Float64}, Float64}, Tuple{}, DynamicPPL.DefaultContext}, DynamicPPL.SampleFromPrior, Turing.ModeEstimation.OptimizationContext{DynamicPPL.DefaultContext}}}, ::Float64, ::Vector{Float64}, ::Vector{Float64}, ::Float64, ::ZigZagBoomerang.LocalBound{Float64}, ::BouncyParticle{Nothing, Nothing, Float64, Float64, Diagonal{Float64, Vector{Float64}}}; iter_offset::Int64, adapt_mass::Bool, oscn::Bool, adapt::Bool, subsample::Bool, progress::Bool, progress_stops::Int64, islocal::Bool, seed::Tuple{UInt64, UInt64}, factor::Float64)
@ ZigZagBoomerang ~/.julia/packages/ZigZagBoomerang/BNuRn/src/not_fact_samplers.jl:339
System Info:
Julia Version 1.8.0
Commit 5544a0fab76 (2022-08-17 13:38 UTC)
Platform Info:
OS: macOS (arm64-apple-darwin21.3.0)
CPU: 8 × Apple M1 Pro
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, apple-m1)
Threads: 1 on 6 virtual cores
Environment:
JULIA_EDITOR = nvim
Environment info:
(slightly different from the Project.toml in the repo, as it was for Julia 1.7 and it still had a local dev dependency on ZigZag, which I had to free first)
First of all, thank you for the awesome package!
I was keen to try it but I got stuck with a method error on whiten()
I've tried to execute by running the example
turing/lr.jl
as is.My debugging efforts have been unsuccessful:
pmdp()
callwhiten()
in PDMats with a scalar value (F.U
defined directly as0.0 # ignored
in the example when instantiating the B. Particle)Error trace:
System Info:
Environment info: (slightly different from the Project.toml in the repo, as it was for Julia 1.7 and it still had a local dev dependency on ZigZag, which I had to free first)