You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to play around with your wonderful package. However, I noticed that using ComponentArrays and a DenseEuclideanMetric does not work.
Here is a quote from the tests.
using AdvancedHMC, ComponentArrays, ForwardDiff
p1 =ComponentVector(μ =2.0, σ =1)
struct DemoProblemComponentArrays endfunction LogDensityProblems.logdensity(::DemoProblemComponentArrays, p::ComponentArray)
return-((1- p.μ) / p.σ)^2end
LogDensityProblems.dimension(::DemoProblemComponentArrays) =2
LogDensityProblems.capabilities(::Type{DemoProblemComponentArrays}) =
LogDensityProblems.LogDensityOrder{0}()
ℓπ =DemoProblemComponentArrays()
# Define a Hamiltonian system
D =length(p1) # number of parameters
metric =DenseEuclideanMetric(D) # !!! IN THE ORIGINAL TESTS, THIS IS DiagEuclideanMetric !!!# choose AD framework or provide a function manually
hamiltonian =Hamiltonian(metric, ℓπ, Val(:ForwardDiff); x = p1)
# Define a leapfrog solver, with initial step size chosen heuristically
initial_ϵ =find_good_stepsize(hamiltonian, p1)
Dear Team,
Thak you for your amazing package!
I tried to play around with your wonderful package. However, I noticed that using ComponentArrays and a DenseEuclideanMetric does not work.
Here is a quote from the tests.
This code fails with:
I think the problem is here:
https://github.com/TuringLang/AdvancedHMC.jl/blob/eb9b2e0d60ef3dd85768d6e6a9f19de15b8f7130/src/hamiltonian.jl#L45C4-L45C4
The result of this operation is a Vector and not a ComponentVector. Probably calling
safe_rsimilar
(AdvancedHMC.jl/src/hamiltonian.jl
Line 94 in eb9b2e0
If you agree, that this is the solution, I am happy to supply a PR.
The text was updated successfully, but these errors were encountered: