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

Turing example broken with MethodError on whiten() #122

Open
svilupp opened this issue Sep 18, 2022 · 0 comments
Open

Turing example broken with MethodError on whiten() #122

svilupp opened this issue Sep 18, 2022 · 0 comments

Comments

@svilupp
Copy link

svilupp commented Sep 18, 2022

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()

ERROR: MethodError: no method matching whiten(::Float64, ::Vector{Float64})

I've tried to execute by running the example turing/lr.jl as is.

My debugging efforts have been unsuccessful:

  • error is coming from the pmdp() call
  • it is called at the beginning and hits this record_rate() call
  • 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)

⌃ [f6369f11] ForwardDiff v0.10.30
⌃ [e9467ef8] GLMakie v0.6.3
⌃ [c7f686f2] MCMCChains v5.3.0
⌅ [ee78f7c6] Makie v0.17.3
⌃ [b1d3bc72] Pathfinder v0.4.5
⌃ [295af30f] Revise v3.3.3
⌃ [fce5fe82] Turing v0.21.3
[36347407] ZigZagBoomerang v0.13.1

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

1 participant