Initializing HMC with Pathfinder
The MCMC warm-up phase
When using MCMC to draw samples from some target distribution, there is often a lengthy warm-up phase with 2 phases:
- converge to the typical set (the region of the target distribution where the bulk of the probability mass is located)
- adapt any tunable parameters of the MCMC sampler (optional)
While (1) often happens fairly quickly, (2) usually requires a lengthy exploration of the typical set to iteratively adapt parameters suitable for further exploration. An example is the widely used windowed adaptation scheme of Hamiltonian Monte Carlo (HMC) in Stan [3], where a step size and positive definite metric (aka mass matrix) are adapted. For posteriors with complex geometry, the adaptation phase can require many evaluations of the gradient of the log density function of the target distribution.
Pathfinder can be used to initialize MCMC, and in particular HMC, in 3 ways:
- Initialize MCMC from one of Pathfinder's draws (replace phase 1 of the warm-up).
- Initialize an HMC metric adaptation from the inverse of the covariance of the multivariate normal approximation (replace the first window of phase 2 of the warm-up).
- Use the inverse of the covariance as the metric without further adaptation (replace phase 2 of the warm-up).
This tutorial demonstrates all three approaches with DynamicHMC.jl and AdvancedHMC.jl. Both of these packages have standalone implementations of adaptive HMC (aka NUTS) and can be used independently of any probabilistic programming language (PPL). Both the Turing and Soss PPLs have some DynamicHMC integration, while Turing also integrates with AdvancedHMC.
For demonstration purposes, we'll use the following dummy data:
using LinearAlgebra, Pathfinder, Random, StatsFuns, StatsPlots
Random.seed!(91)
x = 0:0.01:1
y = @. sin(10x) + randn() * 0.2 + x
scatter(x, y; xlabel="x", ylabel="y", legend=false, msw=0, ms=2)We'll fit this using a simple polynomial regression model:
\[\begin{aligned} \sigma &\sim \text{Half-Normal}(\mu=0, \sigma=1)\\ \alpha, \beta_j &\sim \mathrm{Normal}(\mu=0, \sigma=1)\\ \hat{y}_i &= \alpha + \sum_{j=1}^J x_i^j \beta_j\\ y_i &\sim \mathrm{Normal}(\mu=\hat{y}_i, \sigma=\sigma) \end{aligned}\]
We just need to implement the log-density function of the resulting posterior.
struct RegressionProblem{X,Z,Y}
x::X
J::Int
z::Z
y::Y
end
function RegressionProblem(x, J, y)
z = x .* (1:J)'
return RegressionProblem(x, J, z, y)
end
function (prob::RegressionProblem)(θ)
(; σ, α, β) = θ
(; z, y) = prob
lp = normlogpdf(σ) + logtwo
lp += normlogpdf(α)
lp += sum(normlogpdf, β)
y_hat = muladd(z, β, α)
lp += sum(eachindex(y_hat, y)) do i
return normlogpdf(y_hat[i], σ, y[i])
end
return lp
end
J = 3
dim = J + 2
model = RegressionProblem(x, J, y)
ndraws = 1_000;DynamicHMC.jl
To use DynamicHMC, we first need to transform our model to an unconstrained space using TransformVariables.jl and wrap it in a type that implements the LogDensityProblems interface (see DynamicHMC's worked example):
using DynamicHMC, ForwardDiff, LogDensityProblems, LogDensityProblemsAD, TransformVariables
using TransformedLogDensities: TransformedLogDensity
transform = as((σ=asℝ₊, α=asℝ, β=as(Array, J)))
P = TransformedLogDensity(transform, model)
∇P = ADgradient(:ForwardDiff, P)ForwardDiff AD wrapper for TransformedLogDensity of dimension 5, w/ chunk size 5Pathfinder can take any object that implements this interface.
result_pf = pathfinder(∇P)Single-path Pathfinder result
tries: 1
draws: 5
fit iteration: 17 (total: 18)
fit ELBO: -117.48 ± 0.26
fit distribution: MvNormal{Float64, Pathfinder.WoodburyPDMat{Float64, LinearAlgebra.Diagonal{Float64, Vector{Float64}}, Matrix{Float64}, Matrix{Float64}, Pathfinder.WoodburyPDFactorization{Float64, LinearAlgebra.Diagonal{Float64, Vector{Float64}}, LinearAlgebra.QRCompactWYQ{Float64, Matrix{Float64}, Matrix{Float64}}, LinearAlgebra.UpperTriangular{Float64, Matrix{Float64}}}}, Vector{Float64}}(
dim: 5
μ: [-0.3519374273204352, 0.24690059981721146, 0.05827588220627803, 0.11655176441277385, 0.17482764661876085]
Σ: [0.004959122409986306 -3.311398423331386e-5 … -0.00010842041610912775 8.502868810826309e-5; -3.31139842333169e-5 0.01888167296874881 … -0.003976761689243623 -0.0060626626477276405; … ; -0.00010842041610913816 -0.003976761689243581 … 0.7170576790755047 -0.4272677183876692; 8.502868810828044e-5 -0.006062662647727665 … -0.4272677183876691 0.2601283251145934]
)
init_params = result_pf.draws[:, 1]5-element Vector{Float64}:
-0.2224935031067182
0.46141802142532895
-0.27508471907321225
1.1420276998152994
-0.5639123902280768inv_metric = result_pf.fit_distribution.Σ5×5 Pathfinder.WoodburyPDMat{Float64, LinearAlgebra.Diagonal{Float64, Vector{Float64}}, Matrix{Float64}, Matrix{Float64}, Pathfinder.WoodburyPDFactorization{Float64, LinearAlgebra.Diagonal{Float64, Vector{Float64}}, LinearAlgebra.QRCompactWYQ{Float64, Matrix{Float64}, Matrix{Float64}}, LinearAlgebra.UpperTriangular{Float64, Matrix{Float64}}}}:
0.00495912 -3.3114e-5 -4.65522e-6 -0.00010842 8.50287e-5
-3.3114e-5 0.0188817 -0.0020078 -0.00397676 -0.00606266
-4.65522e-6 -0.0020078 0.0336821 -0.144189 0.0862468
-0.00010842 -0.00397676 -0.144189 0.717058 -0.427268
8.50287e-5 -0.00606266 0.0862468 -0.427268 0.260128Initializing from Pathfinder's draws
Here we just need to pass one of the draws as the initial point q:
result_dhmc1 = mcmc_with_warmup(
Random.default_rng(),
∇P,
ndraws;
initialization=(; q=init_params),
reporter=NoProgressReport(),
)(posterior_matrix = [-0.24810308965962047 -0.3504549178041192 … -0.3223335247257568 -0.3627030912938251; 0.11572606691598791 0.05868443454455449 … 0.17458155665411307 0.1808919760685688; … ; 0.33222085981815286 -1.3376126081213608 … 1.7803949374828016 -0.8066755317645785; -0.12857792111900557 1.495581900496136 … -0.6594331159797231 0.8329844581135699], tree_statistics = DynamicHMC.TreeStatisticsNUTS[DynamicHMC.TreeStatisticsNUTS(-119.56593794159016, 6, turning at positions -37:-40, 0.8578186120856843, 103, DynamicHMC.Directions(0x585834bf)), DynamicHMC.TreeStatisticsNUTS(-121.63600916056208, 6, turning at positions -39:-42, 0.9646096968644416, 103, DynamicHMC.Directions(0x6a55493d)), DynamicHMC.TreeStatisticsNUTS(-117.12997020210554, 2, turning at positions 0:3, 0.950037795589619, 3, DynamicHMC.Directions(0x44d87423)), DynamicHMC.TreeStatisticsNUTS(-122.15636956732143, 6, turning at positions -28:35, 0.9500146583256789, 63, DynamicHMC.Directions(0xcb3283e3)), DynamicHMC.TreeStatisticsNUTS(-118.81681489077805, 5, turning at positions -14:17, 0.9958610219500296, 31, DynamicHMC.Directions(0xf9536091)), DynamicHMC.TreeStatisticsNUTS(-121.12775664244207, 6, turning at positions 37:100, 0.9993664936958542, 127, DynamicHMC.Directions(0x3d933de4)), DynamicHMC.TreeStatisticsNUTS(-120.34191301775185, 6, turning at positions -17:46, 0.8172553974588842, 63, DynamicHMC.Directions(0xc68b812e)), DynamicHMC.TreeStatisticsNUTS(-116.13626639553016, 6, turning at positions -40:23, 0.9978268321277802, 63, DynamicHMC.Directions(0x448ba757)), DynamicHMC.TreeStatisticsNUTS(-115.01252917735385, 6, turning at positions -4:59, 0.9860982720609994, 63, DynamicHMC.Directions(0x38f1a63b)), DynamicHMC.TreeStatisticsNUTS(-114.6148040293635, 5, turning at positions 49:52, 0.9643683980304437, 63, DynamicHMC.Directions(0x7f977fb4)) … DynamicHMC.TreeStatisticsNUTS(-119.14845443990916, 6, turning at positions -15:-46, 0.9481304922072431, 95, DynamicHMC.Directions(0xf47d8b31)), DynamicHMC.TreeStatisticsNUTS(-117.9372906640522, 6, turning at positions -32:-95, 0.9933981821471434, 127, DynamicHMC.Directions(0x795ec820)), DynamicHMC.TreeStatisticsNUTS(-119.19625398535807, 4, turning at positions 14:17, 0.588908033137959, 19, DynamicHMC.Directions(0xbfa9087d)), DynamicHMC.TreeStatisticsNUTS(-115.18389401458256, 4, turning at positions -6:-21, 0.9998523843212445, 31, DynamicHMC.Directions(0xe075f44a)), DynamicHMC.TreeStatisticsNUTS(-116.84526644390498, 6, turning at positions -26:37, 0.825494463586972, 63, DynamicHMC.Directions(0x5170e5e5)), DynamicHMC.TreeStatisticsNUTS(-121.38529483885462, 6, turning at positions -13:-76, 0.9976569838490694, 127, DynamicHMC.Directions(0x6eea1533)), DynamicHMC.TreeStatisticsNUTS(-119.85349210490877, 7, turning at positions -10:117, 0.993113377549815, 127, DynamicHMC.Directions(0x5dfe9275)), DynamicHMC.TreeStatisticsNUTS(-119.54682540027902, 6, turning at positions -53:10, 0.9352124981243225, 63, DynamicHMC.Directions(0xeb53440a)), DynamicHMC.TreeStatisticsNUTS(-117.61628157598375, 6, turning at positions -1:62, 0.9953756169177176, 63, DynamicHMC.Directions(0x54404c7e)), DynamicHMC.TreeStatisticsNUTS(-115.7517499414995, 7, turning at positions -65:62, 0.9475725146941996, 127, DynamicHMC.Directions(0xf88b68be))], logdensities = [-116.10293287232932, -116.33722368557945, -116.3079544094065, -117.77294693440427, -117.7741738281816, -117.95272003255118, -113.67095945032776, -114.55451543919801, -113.37011576333325, -112.57514826889451 … -113.064444488066, -113.17983367989913, -113.7685988144028, -113.0527805791166, -115.86670510064677, -117.34763929799689, -118.62367022735486, -115.86226589669143, -114.27201390347416, -113.28297451367884], κ = Gaussian kinetic energy (Diagonal), √diag(M⁻¹): [0.07337416761158251, 0.12067206485476573, 0.9653397988645301, 0.8173196611431905, 0.5623262115594393], ϵ = 0.04808724600484354)Initializing metric adaptation from Pathfinder's estimate
To start with Pathfinder's inverse metric estimate, we just need to initialize a DynamicHMC.GaussianKineticEnergy object with it as input:
result_dhmc2 = mcmc_with_warmup(
Random.default_rng(),
∇P,
ndraws;
initialization=(; q=init_params, κ=GaussianKineticEnergy(inv_metric)),
warmup_stages=default_warmup_stages(; M=Symmetric),
reporter=NoProgressReport(),
)(posterior_matrix = [-0.3693777320994347 -0.4196948301913037 … -0.4424098296726639 -0.3712190987452295; 0.047866230883314084 0.26875558460056653 … 0.21019329988491053 0.3390971939807188; … ; 1.6521302637013986 0.8355020982748176 … 0.7713290373213713 1.4588671699807385; -0.8015359653011418 -0.20485691492561015 … 0.12976025695881155 -0.17941386540520557], tree_statistics = DynamicHMC.TreeStatisticsNUTS[DynamicHMC.TreeStatisticsNUTS(-119.1740557946756, 3, turning at positions -5:-8, 0.9645463898890161, 11, DynamicHMC.Directions(0x7a9d05b3)), DynamicHMC.TreeStatisticsNUTS(-117.06923022616394, 3, turning at positions -6:1, 0.9999999999999999, 7, DynamicHMC.Directions(0x9a674ce1)), DynamicHMC.TreeStatisticsNUTS(-117.25007903383721, 3, turning at positions -6:1, 0.9704153393578109, 7, DynamicHMC.Directions(0xe186b761)), DynamicHMC.TreeStatisticsNUTS(-118.54075669348539, 3, turning at positions -4:3, 0.968651043761646, 7, DynamicHMC.Directions(0x890e0dfb)), DynamicHMC.TreeStatisticsNUTS(-119.52081768531998, 4, turning at positions -2:13, 0.8591103131323917, 15, DynamicHMC.Directions(0xec6caf5d)), DynamicHMC.TreeStatisticsNUTS(-116.40975229057683, 3, turning at positions -1:6, 0.9999045919291827, 7, DynamicHMC.Directions(0x4c2846e6)), DynamicHMC.TreeStatisticsNUTS(-113.67039567820662, 3, turning at positions -2:-9, 0.9979847985973598, 15, DynamicHMC.Directions(0xc00a52f6)), DynamicHMC.TreeStatisticsNUTS(-113.75860045606372, 4, turning at positions 0:15, 0.9967269913788072, 15, DynamicHMC.Directions(0x6fd2c66f)), DynamicHMC.TreeStatisticsNUTS(-114.54944918879384, 3, turning at positions -4:-11, 0.8024467461041344, 15, DynamicHMC.Directions(0x90635db4)), DynamicHMC.TreeStatisticsNUTS(-118.06052428531278, 4, turning at positions -12:3, 0.9241049610116121, 15, DynamicHMC.Directions(0xe3a357c3)) … DynamicHMC.TreeStatisticsNUTS(-115.25874038003991, 3, turning at positions -4:3, 0.9998030519072232, 7, DynamicHMC.Directions(0x4181f953)), DynamicHMC.TreeStatisticsNUTS(-115.02340252820122, 3, turning at positions -6:1, 0.9602848161772094, 7, DynamicHMC.Directions(0xd4cf3651)), DynamicHMC.TreeStatisticsNUTS(-116.39003520114768, 3, turning at positions 0:7, 0.9060490527776313, 7, DynamicHMC.Directions(0x452f4d5f)), DynamicHMC.TreeStatisticsNUTS(-119.14989661999597, 3, turning at positions -6:1, 0.9747694190954876, 7, DynamicHMC.Directions(0xcd736b79)), DynamicHMC.TreeStatisticsNUTS(-118.73850057858196, 4, turning at positions -15:0, 1.0, 15, DynamicHMC.Directions(0x9ee52b90)), DynamicHMC.TreeStatisticsNUTS(-121.60222788754078, 4, turning at positions -12:3, 0.9368965490227641, 15, DynamicHMC.Directions(0x462110a3)), DynamicHMC.TreeStatisticsNUTS(-117.67926266353676, 3, turning at positions -3:4, 0.9999999999999999, 7, DynamicHMC.Directions(0xf959b5c4)), DynamicHMC.TreeStatisticsNUTS(-119.49783972366036, 3, turning at positions -4:3, 0.8339580996147962, 7, DynamicHMC.Directions(0x6e1d2b73)), DynamicHMC.TreeStatisticsNUTS(-122.77422503454012, 2, turning at positions 4:7, 0.9444972083975881, 7, DynamicHMC.Directions(0x547b2f57)), DynamicHMC.TreeStatisticsNUTS(-119.5782878165084, 4, turning at positions -5:10, 0.9764972050551984, 15, DynamicHMC.Directions(0x00758a2a))], logdensities = [-116.27828049040022, -114.41352507078611, -114.91010238191042, -115.72309740142838, -115.07662778070389, -113.17973826151578, -113.03562011512899, -112.85324592453983, -113.74118228795624, -114.9249129043779 … -113.06813628538349, -114.15951892735472, -115.15046941800293, -116.63209880791703, -117.42748268422397, -117.06775393681328, -116.29895427534595, -116.48963893206306, -115.64857645778032, -116.83066311743609], κ = Gaussian kinetic energy (Symmetric), √diag(M⁻¹): [0.07143222626616341, 0.14961329904552648, 0.9256029306145168, 0.8728157231371529, 0.6137271088630788], ϵ = 0.3708791066151819)We also specified that DynamicHMC should tune a dense Symmetric matrix. However, we could also have requested a Diagonal metric.
Use Pathfinder's metric estimate for sampling
To turn off metric adaptation entirely and use Pathfinder's estimate, we just set the number and size of the metric adaptation windows to 0.
result_dhmc3 = mcmc_with_warmup(
Random.default_rng(),
∇P,
ndraws;
initialization=(; q=init_params, κ=GaussianKineticEnergy(inv_metric)),
warmup_stages=default_warmup_stages(; middle_steps=0, doubling_stages=0),
reporter=NoProgressReport(),
)(posterior_matrix = [-0.3636756389287475 -0.2668697359826206 … -0.33805902566891943 -0.4206863987846029; 0.34244509751134006 0.3148028656395438 … 0.08824834399237762 0.48987511236027037; … ; -0.8549265272371018 1.5125973966636432 … 0.6983322295546875 -0.2417885568204775; 0.4558846187422013 -0.09628348269974843 … 0.10754071829442141 0.5630682054395401], tree_statistics = DynamicHMC.TreeStatisticsNUTS[DynamicHMC.TreeStatisticsNUTS(-120.17412442849302, 3, turning at positions -7:0, 0.8766414913791916, 7, DynamicHMC.Directions(0xc7e97680)), DynamicHMC.TreeStatisticsNUTS(-117.65132903085623, 5, turning at positions 29:32, 0.8886442778280222, 35, DynamicHMC.Directions(0x7f1e7f3c)), DynamicHMC.TreeStatisticsNUTS(-118.49356608520813, 3, turning at positions -6:1, 0.961107235634208, 7, DynamicHMC.Directions(0x87504e11)), DynamicHMC.TreeStatisticsNUTS(-116.62116620904017, 3, turning at positions -3:4, 0.9986143572286397, 7, DynamicHMC.Directions(0xf738ceac)), DynamicHMC.TreeStatisticsNUTS(-117.3342948620258, 3, turning at positions -1:6, 0.8226786290029416, 7, DynamicHMC.Directions(0xe80e7a6e)), DynamicHMC.TreeStatisticsNUTS(-117.65991993613818, 5, turning at positions -11:-18, 0.9803506498902309, 47, DynamicHMC.Directions(0x7f880d5d)), DynamicHMC.TreeStatisticsNUTS(-115.03680010777865, 2, turning at positions -1:2, 0.9280899731252389, 3, DynamicHMC.Directions(0xbd4ad9ce)), DynamicHMC.TreeStatisticsNUTS(-117.00724048704248, 2, turning at positions -3:0, 0.8308684880815992, 3, DynamicHMC.Directions(0x567fd034)), DynamicHMC.TreeStatisticsNUTS(-117.22823287094656, 3, turning at positions -8:-11, 0.9813909244157052, 15, DynamicHMC.Directions(0xfb27be44)), DynamicHMC.TreeStatisticsNUTS(-114.77464954324385, 2, turning at positions -3:0, 0.9086526474956359, 3, DynamicHMC.Directions(0x8ba17b0c)) … DynamicHMC.TreeStatisticsNUTS(-116.78646236716733, 4, turning at positions -10:-17, 0.9631640834536866, 23, DynamicHMC.Directions(0xa2892e26)), DynamicHMC.TreeStatisticsNUTS(-116.84417493185788, 3, turning at positions -1:6, 0.9861654753941111, 7, DynamicHMC.Directions(0x3cad8c66)), DynamicHMC.TreeStatisticsNUTS(-118.06386509845706, 4, turning at positions 22:29, 0.9972446779604973, 31, DynamicHMC.Directions(0x68bd48fd)), DynamicHMC.TreeStatisticsNUTS(-115.50867326481645, 2, turning at positions -2:1, 0.9999999999999999, 3, DynamicHMC.Directions(0x0b29ba51)), DynamicHMC.TreeStatisticsNUTS(-116.01201909288692, 3, turning at positions 10:13, 0.9456014622765867, 15, DynamicHMC.Directions(0x0d40929d)), DynamicHMC.TreeStatisticsNUTS(-116.95759658062461, 5, turning at positions 50:53, 0.876360228271483, 55, DynamicHMC.Directions(0xceecb5bd)), DynamicHMC.TreeStatisticsNUTS(-116.53737183863275, 3, turning at positions -7:0, 0.9299003944171969, 7, DynamicHMC.Directions(0xdb100048)), DynamicHMC.TreeStatisticsNUTS(-117.82274880021596, 3, turning at positions 0:7, 0.9675396204701335, 7, DynamicHMC.Directions(0x07fd626f)), DynamicHMC.TreeStatisticsNUTS(-116.35843868863182, 2, turning at positions -2:1, 0.9999999999999999, 3, DynamicHMC.Directions(0x9732e4f9)), DynamicHMC.TreeStatisticsNUTS(-116.55390065131103, 3, turning at positions -6:1, 0.8638307522107361, 7, DynamicHMC.Directions(0x570cc221))], logdensities = [-113.29695736574153, -116.03880401776337, -116.29784800435665, -114.53876423731144, -115.09319911359412, -114.00735831644535, -114.40795998845898, -115.72236005514823, -113.59094192052989, -114.61745879192351 … -114.64901969478689, -114.24778267262911, -115.31960106588775, -113.9193328410817, -114.52035969074585, -114.02782334646838, -115.02497749006234, -116.08842152595766, -113.22100011068866, -115.05735568704817], κ = Gaussian kinetic energy (WoodburyPDMat), √diag(M⁻¹): [0.07042103670059328, 0.13741059991408527, 0.1835267592270858, 0.846792583266708, 0.5100277689641941], ϵ = 0.7471092611677245)AdvancedHMC.jl
Similar to Pathfinder and DynamicHMC, AdvancedHMC can also work with a LogDensityProblem:
using AdvancedHMC
nadapts = 500;Initializing from Pathfinder's draws
metric = DiagEuclideanMetric(dim)
hamiltonian = Hamiltonian(metric, ∇P)
ϵ = find_good_stepsize(hamiltonian, init_params)
integrator = Leapfrog(ϵ)
kernel = HMCKernel(Trajectory{MultinomialTS}(integrator, GeneralisedNoUTurn()))
adaptor = StepSizeAdaptor(0.8, integrator)
samples_ahmc1, stats_ahmc1 = sample(
hamiltonian,
kernel,
init_params,
ndraws + nadapts,
adaptor,
nadapts;
drop_warmup=true,
progress=false,
)([[-0.37459723048035476, 0.21066229449023327, 0.5891087161425435, -0.6000250400460935, 0.5296132032529005], [-0.28296678639239253, 0.3046120906070502, -0.3194123281054572, -0.4716225214752896, 0.6677620656973162], [-0.4400923352572665, 0.23614774415632186, 1.9663146529782005, 0.8023009661849969, -0.9191731801056902], [-0.2637406950520797, 0.3918134609964784, 1.733557716085748, 0.7277406980290888, -0.8887509320343253], [-0.4174077319249557, 0.012460345419397872, 1.6512284285941203, 0.7300926515371825, -0.6365929115514386], [-0.37766394853262913, -0.05344030412623964, 0.7826070841997521, 0.24775516465433803, -0.018600695130232436], [-0.4742783351424477, 0.06235548331828193, 0.8384001390533297, 0.2931236155544901, -0.1456151319779113], [-0.20213873690020465, 0.38395637362593255, 0.7928257966678228, 0.20882574010621754, -0.21960730907775836], [-0.27459841859268125, 0.1989443549373351, 1.1688816715308679, 0.21129276099738717, -0.2713162950885376], [-0.3519604775166212, 0.20188988804431804, 0.09219508941940832, -0.3103909872254515, 0.4189950293016648] … [-0.33992567868346185, 0.21530716539806108, -0.2828119843170205, 1.5483683977727396, -0.5778928461979379], [-0.34894763396370054, 0.1954321806104055, -0.4435318093670991, -0.22025463028564163, 0.5840782267049006], [-0.37878640344344255, 0.14029948972911974, -1.2771936198590745, 1.2547548497512044, -0.08488112619635611], [-0.44275003740888774, 0.02512157780596689, -1.2756186136877592, 1.2642371664056504, -0.023750836826041052], [-0.4844640809606963, 0.444177889956799, 1.5684900686335947, 0.7886285836219616, -0.8622278404279546], [-0.40403278865422415, 0.08106788595942141, 0.9846736502098132, 0.318345931864523, -0.19669006959054308], [-0.33477991710502436, 0.09226177533485883, 0.9730311983281986, 0.3363233486250575, -0.2245184069936878], [-0.4114714628890664, 0.12696867388531513, 0.963537393277842, 0.32994707675310697, -0.18779148979775118], [-0.40271896561113985, 0.3722476017134214, 1.5006423559097108, -0.0013264966083876024, -0.25621925489002884], [-0.3214639947177173, 0.3518044476537368, 1.379780738213113, 0.007354060382909403, -0.26025618935729017]], NamedTuple[(n_steps = 15, is_accept = true, acceptance_rate = 0.9896001709102095, log_density = -113.03595486258291, hamiltonian_energy = 114.83213160484036, hamiltonian_energy_error = -0.3208638839924731, max_hamiltonian_energy_error = -0.3731591428485359, tree_depth = 3, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false), (n_steps = 63, is_accept = true, acceptance_rate = 0.5681615837897253, log_density = -112.97620818589427, hamiltonian_energy = 116.06184943664212, hamiltonian_energy_error = 0.12604491443454435, max_hamiltonian_energy_error = 1.1945774863120846, tree_depth = 6, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false), (n_steps = 95, is_accept = true, acceptance_rate = 0.9680385860841418, log_density = -115.57411119644127, hamiltonian_energy = 118.46461529149876, hamiltonian_energy_error = -0.0011683919897791384, max_hamiltonian_energy_error = 0.11711820167555231, tree_depth = 6, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false), (n_steps = 15, is_accept = true, acceptance_rate = 0.9293033469236193, log_density = -115.60553252455952, hamiltonian_energy = 116.76309463952205, hamiltonian_energy_error = 0.08315499569165752, max_hamiltonian_energy_error = 0.1952173344650845, tree_depth = 3, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false), (n_steps = 23, is_accept = true, acceptance_rate = 0.9739043319800843, log_density = -116.01334664476511, hamiltonian_energy = 117.31832401125635, hamiltonian_energy_error = -0.0696344747846922, max_hamiltonian_energy_error = 0.12772882711547595, tree_depth = 4, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false), (n_steps = 63, is_accept = true, acceptance_rate = 0.9016860225446537, log_density = -114.99783983054739, hamiltonian_energy = 117.70898112464093, hamiltonian_energy_error = 0.10274479111316737, max_hamiltonian_energy_error = 0.2771574741209122, tree_depth = 5, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false), (n_steps = 15, is_accept = true, acceptance_rate = 0.8502521084584411, log_density = -115.70382040511781, hamiltonian_energy = 119.01170113994621, hamiltonian_energy_error = 0.328983283864801, max_hamiltonian_energy_error = 0.328983283864801, tree_depth = 4, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false), (n_steps = 15, is_accept = true, acceptance_rate = 0.8789026647196875, log_density = -114.94435141565143, hamiltonian_energy = 116.67588555926082, hamiltonian_energy_error = 0.03955597280500456, max_hamiltonian_energy_error = 0.3881994699986677, tree_depth = 3, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false), (n_steps = 31, is_accept = true, acceptance_rate = 0.9703340450080892, log_density = -113.76879443734133, hamiltonian_energy = 116.28418370642436, hamiltonian_energy_error = 0.018226246820162828, max_hamiltonian_energy_error = -0.2095330746042663, tree_depth = 4, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false), (n_steps = 63, is_accept = true, acceptance_rate = 0.8362313551844703, log_density = -113.06245565119367, hamiltonian_energy = 114.79414518895639, hamiltonian_energy_error = 0.08530429004822793, max_hamiltonian_energy_error = 0.6276996540761246, tree_depth = 6, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false) … (n_steps = 63, is_accept = true, acceptance_rate = 0.4223655097886096, log_density = -115.05194393379448, hamiltonian_energy = 119.39642664363816, hamiltonian_energy_error = 0.4290062622382038, max_hamiltonian_energy_error = 2.828452156161319, tree_depth = 6, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false), (n_steps = 63, is_accept = true, acceptance_rate = 0.7815436159893857, log_density = -112.42664112789762, hamiltonian_energy = 116.04852430229217, hamiltonian_energy_error = -0.7393367710154166, max_hamiltonian_energy_error = 0.8791526782906516, tree_depth = 6, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false), (n_steps = 63, is_accept = true, acceptance_rate = 0.7939571287576032, log_density = -114.03431224880818, hamiltonian_energy = 116.38458477731338, hamiltonian_energy_error = -0.025202219510049417, max_hamiltonian_energy_error = 0.597186583186641, tree_depth = 6, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false), (n_steps = 7, is_accept = true, acceptance_rate = 0.7397209924780086, log_density = -116.13115173940476, hamiltonian_energy = 117.34524684528847, hamiltonian_energy_error = 0.055276671413224676, max_hamiltonian_energy_error = 0.5778505156390423, tree_depth = 3, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false), (n_steps = 127, is_accept = true, acceptance_rate = 0.9092278159030781, log_density = -117.2997749401061, hamiltonian_energy = 121.73959030097406, hamiltonian_energy_error = 0.19592529202761, max_hamiltonian_energy_error = 0.23517388360207292, tree_depth = 6, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false), (n_steps = 47, is_accept = true, acceptance_rate = 0.6870060412646738, log_density = -113.71825036840774, hamiltonian_energy = 119.48630886553252, hamiltonian_energy_error = -0.01717304423640087, max_hamiltonian_energy_error = 1.1197454982182222, tree_depth = 5, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false), (n_steps = 3, is_accept = true, acceptance_rate = 0.9424258145948171, log_density = -113.41432529194893, hamiltonian_energy = 114.06128480798175, hamiltonian_energy_error = 0.061061918319737174, max_hamiltonian_energy_error = 0.12046010235491167, tree_depth = 2, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false), (n_steps = 7, is_accept = true, acceptance_rate = 0.9468672924621727, log_density = -113.53277332499056, hamiltonian_energy = 115.56678093523222, hamiltonian_energy_error = -0.07478612210542224, max_hamiltonian_energy_error = 0.15197099912448664, tree_depth = 2, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false), (n_steps = 39, is_accept = true, acceptance_rate = 0.8181007881372668, log_density = -114.31730694597057, hamiltonian_energy = 115.44608642099462, hamiltonian_energy_error = 0.1929058737074314, max_hamiltonian_energy_error = 0.5121157974657535, tree_depth = 5, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false), (n_steps = 23, is_accept = true, acceptance_rate = 1.0, log_density = -113.47659636959801, hamiltonian_energy = 114.58435310998337, hamiltonian_energy_error = -0.20198972096933687, max_hamiltonian_energy_error = -0.23667771903518542, tree_depth = 4, numerical_error = false, step_size = 0.040020173506362056, nom_step_size = 0.040020173506362056, is_adapt = false)])Initializing metric adaptation from Pathfinder's estimate
We can't start with Pathfinder's inverse metric estimate directly. Instead we need to first extract its diagonal for a DiagonalEuclideanMetric or make it dense for a DenseEuclideanMetric:
metric = DenseEuclideanMetric(Matrix(inv_metric))
hamiltonian = Hamiltonian(metric, ∇P)
ϵ = find_good_stepsize(hamiltonian, init_params)
integrator = Leapfrog(ϵ)
kernel = HMCKernel(Trajectory{MultinomialTS}(integrator, GeneralisedNoUTurn()))
adaptor = StepSizeAdaptor(0.8, integrator)
samples_ahmc2, stats_ahmc2 = sample(
hamiltonian,
kernel,
init_params,
ndraws + nadapts,
adaptor,
nadapts;
drop_warmup=true,
progress=false,
)([[-0.18780084683044174, 0.2486347715245892, -0.6237599033671324, 1.1670704191682004, -0.2845782562681352], [-0.447072557944117, 0.22615767779067036, -0.23946690756684308, -0.992259678358179, 1.022055074944943], [-0.23331315115296491, 0.23463727981613086, -0.654927015052478, 1.0644437453944757, -0.21421264024646403], [-0.24222600136210176, 0.24190990270074475, -1.4053994828476626, 1.1527806486055563, -0.026892957098167303], [-0.45199375490781435, 0.24373657686069583, -0.942604936266619, -1.0061749613460447, 1.2584854716084086], [-0.20270969185739648, 0.2915701087030681, -1.4328471466081314, 1.2630169080603668, -0.13872838693691958], [-0.20219250390757795, 0.0952196309772214, -1.6461001565561113, -0.3814903975230468, 1.1388510708306985], [-0.3810673373715115, 0.28386645712506126, -1.8620249375654265, 0.29957889656147607, 0.6617415645409291], [-0.10808590939326977, 0.1500644683945082, -1.632839640292229, -0.45350383803008076, 1.2305050824561388], [-0.5841376558822365, 0.22976158887800485, 0.20958374063595248, 0.8966486613241732, -0.40674200745728334] … [-0.2682872554812159, 0.3101103245372633, 0.9868574313656868, -0.7531863438599421, 0.4442148369133422], [-0.22859495759324058, 0.040320607034598666, 1.146908041760609, -1.2651072478181038, 0.7954192502367452], [-0.3756092810154448, 0.16028381422433044, 0.5602669240103273, 1.1181166928806858, -0.6297624074884662], [-0.27330379361900414, 0.16918784733222414, 0.8634092886777224, -0.3212727230956347, 0.2402565076544675], [-0.2888441576294046, 0.44995490354660134, -1.2303736934400769, -0.28787911316662945, 0.6770921978813872], [-0.4206374541543677, 0.19164228405356365, -1.0697945710513659, -0.8986927003541548, 1.2669772960463792], [-0.2469158289362951, 0.4420681638939151, -1.0535030987973044, -0.6828833095878708, 0.9672466075212945], [-0.3849139832309234, 0.10571108506934948, -0.9396018843623839, -0.07647555392920502, 0.7129198238532444], [-0.4235057793806839, 0.17925480658014553, -1.2720411795928672, 0.1217790125952937, 0.6326082303968887], [-0.21499999500721168, 0.30325984651681714, -1.43801064163143, 0.2262263324416316, 0.5966233983490076]], NamedTuple[(n_steps = 23, is_accept = true, acceptance_rate = 0.7608858538948773, log_density = -115.45545948546904, hamiltonian_energy = 118.43441933765183, hamiltonian_energy_error = 0.4416320745665985, max_hamiltonian_energy_error = 0.6233107553560444, tree_depth = 4, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false), (n_steps = 3, is_accept = true, acceptance_rate = 0.8398883705560113, log_density = -114.0770967448892, hamiltonian_energy = 117.29528772304846, hamiltonian_energy_error = -0.6229902075055662, max_hamiltonian_energy_error = -0.6804811884029647, tree_depth = 2, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false), (n_steps = 3, is_accept = true, acceptance_rate = 0.726176816130764, log_density = -114.16785872707817, hamiltonian_energy = 117.28664886342784, hamiltonian_energy_error = 0.06649859699767546, max_hamiltonian_energy_error = 0.6886788612152941, tree_depth = 2, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false), (n_steps = 19, is_accept = true, acceptance_rate = 0.8134854565376499, log_density = -114.83085106259321, hamiltonian_energy = 119.12073301488367, hamiltonian_energy_error = 0.03289727332133907, max_hamiltonian_energy_error = 0.5274394740066555, tree_depth = 4, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false), (n_steps = 3, is_accept = true, acceptance_rate = 0.9799262433995354, log_density = -114.86956611899558, hamiltonian_energy = 115.67335259122805, hamiltonian_energy_error = 0.030292088292625863, max_hamiltonian_energy_error = -0.3247705996610222, tree_depth = 2, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false), (n_steps = 3, is_accept = true, acceptance_rate = 0.5948725153768917, log_density = -116.10306492905984, hamiltonian_energy = 118.22617482943477, hamiltonian_energy_error = 0.5615509756635504, max_hamiltonian_energy_error = 0.6361326961018534, tree_depth = 2, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false), (n_steps = 15, is_accept = true, acceptance_rate = 0.9446947693088777, log_density = -116.64439620976064, hamiltonian_energy = 120.50907279978448, hamiltonian_energy_error = -0.15511571321735573, max_hamiltonian_energy_error = 0.2211797914186917, tree_depth = 3, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false), (n_steps = 3, is_accept = true, acceptance_rate = 0.8244468910912843, log_density = -114.22719651590216, hamiltonian_energy = 118.01695248752712, hamiltonian_energy_error = -0.7983872928815003, max_hamiltonian_energy_error = -0.7983872928815003, tree_depth = 1, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false), (n_steps = 3, is_accept = true, acceptance_rate = 0.34243772640311, log_density = -120.28653559386446, hamiltonian_energy = 120.54474328460132, hamiltonian_energy_error = 1.5303889160865225, max_hamiltonian_energy_error = 1.5303889160865225, tree_depth = 2, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false), (n_steps = 27, is_accept = true, acceptance_rate = 0.9226455829322924, log_density = -119.14558475583284, hamiltonian_energy = 126.9160563540678, hamiltonian_energy_error = 0.017946649185958563, max_hamiltonian_energy_error = -1.2936071047814153, tree_depth = 4, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false) … (n_steps = 31, is_accept = true, acceptance_rate = 0.8325446788760051, log_density = -113.91911223779705, hamiltonian_energy = 117.03639251438206, hamiltonian_energy_error = 0.1551473148844451, max_hamiltonian_energy_error = 0.5448866076086745, tree_depth = 4, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false), (n_steps = 3, is_accept = true, acceptance_rate = 0.5235474377761763, log_density = -116.49699152643771, hamiltonian_energy = 118.43787624786565, hamiltonian_energy_error = 0.6271969160035127, max_hamiltonian_energy_error = 0.6657214497975588, tree_depth = 2, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false), (n_steps = 3, is_accept = true, acceptance_rate = 1.0, log_density = -113.33811660221076, hamiltonian_energy = 116.7266238811248, hamiltonian_energy_error = -0.7380330581438272, max_hamiltonian_energy_error = -0.7380330581438272, tree_depth = 2, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false), (n_steps = 3, is_accept = true, acceptance_rate = 1.0, log_density = -113.22265512715259, hamiltonian_energy = 113.98478653784778, hamiltonian_energy_error = -0.03814639003667253, max_hamiltonian_energy_error = -0.03814639003667253, tree_depth = 2, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false), (n_steps = 35, is_accept = true, acceptance_rate = 0.7374939771126422, log_density = -116.95175676196752, hamiltonian_energy = 117.79254435147895, hamiltonian_energy_error = 0.6818979208917852, max_hamiltonian_energy_error = 0.6821777496648167, tree_depth = 5, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false), (n_steps = 3, is_accept = true, acceptance_rate = 0.6141528292283182, log_density = -114.45904492261803, hamiltonian_energy = 119.4157991030909, hamiltonian_energy_error = -0.5870118046240123, max_hamiltonian_energy_error = 1.0364847407516322, tree_depth = 2, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false), (n_steps = 7, is_accept = true, acceptance_rate = 0.6997753102254958, log_density = -115.23498420479216, hamiltonian_energy = 117.25824268125075, hamiltonian_energy_error = 0.25827005855137486, max_hamiltonian_energy_error = 0.5206035973000382, tree_depth = 2, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false), (n_steps = 15, is_accept = true, acceptance_rate = 0.9780187974255592, log_density = -113.42009981402828, hamiltonian_energy = 116.03031628431432, hamiltonian_energy_error = -0.4307496522242218, max_hamiltonian_energy_error = -0.4597375072654444, tree_depth = 3, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false), (n_steps = 11, is_accept = true, acceptance_rate = 0.9928588016603616, log_density = -113.8319283023507, hamiltonian_energy = 114.46793741508216, hamiltonian_energy_error = 0.00513512737167332, max_hamiltonian_energy_error = -0.04796866992666082, tree_depth = 3, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false), (n_steps = 7, is_accept = true, acceptance_rate = 0.45069045907245453, log_density = -115.22197248886101, hamiltonian_energy = 119.13909113791675, hamiltonian_energy_error = 0.5432383857039724, max_hamiltonian_energy_error = 1.471168036501794, tree_depth = 2, numerical_error = false, step_size = 1.0202863802823825, nom_step_size = 1.0202863802823825, is_adapt = false)])Use Pathfinder's metric estimate for sampling
To use Pathfinder's metric with no metric adaptation, we need to use Pathfinder's own Pathfinder.RankUpdateEuclideanMetric type, which just wraps our inverse metric estimate for use with AdvancedHMC:
nadapts = 75
metric = Pathfinder.RankUpdateEuclideanMetric(inv_metric)
hamiltonian = Hamiltonian(metric, ∇P)
ϵ = find_good_stepsize(hamiltonian, init_params)
integrator = Leapfrog(ϵ)
kernel = HMCKernel(Trajectory{MultinomialTS}(integrator, GeneralisedNoUTurn()))
adaptor = StepSizeAdaptor(0.8, integrator)
samples_ahmc3, stats_ahmc3 = sample(
hamiltonian,
kernel,
init_params,
ndraws + nadapts,
adaptor,
nadapts;
drop_warmup=true,
progress=false,
)([[-0.21400992324239188, 0.11279220071953991, -1.0050085321289584, -0.031617255913456876, 0.7164069921932773], [-0.280140628765328, 0.20624655447245824, -0.979023428183672, -0.227253173376112, 0.7509869522015677], [-0.2627250886831841, 0.17890868578204122, -0.4222139112748052, 0.26430110433086407, 0.2271618326862081], [-0.251435150028469, 0.24424294680506342, -0.9263749240377966, 0.4445924681039501, 0.2637667966645517], [-0.3004279371681007, 0.15901159094223727, -0.44818859339344175, -1.5700329564343691, 1.4994981799882767], [-0.41657003773373563, 0.23575020220703533, -0.6158273347097478, -0.5626013882045291, 0.8633878182328242], [-0.25822959702709786, 0.5280571888024626, -0.6223026448311453, -0.4571935437972756, 0.7287860512642149], [-0.42817261343990354, 0.3233201551203756, 0.14200232967968612, 0.20711547304990988, 0.12690272085904059], [-0.422476284777453, 0.27022088800894406, -0.4522777401431966, -0.25056203002777716, 0.5757098045005296], [-0.458350905795959, 0.1310213857520062, -0.42661808660626155, -0.429813778052638, 0.819742615795177] … [-0.451375554907331, 0.15516207282287064, -0.660447857445769, 0.44581164792912736, 0.21511436971121298], [-0.3945394996171062, 0.30651942156973205, -0.7562624177417017, 0.25058542143653006, 0.2825553305134466], [-0.28344464501774574, 0.22457590037937922, 0.287589815387968, -0.12881496080124955, 0.324366821398141], [-0.29604702312533093, 0.15617532339143367, 0.6594919987986999, -0.09646862230922926, 0.18452697594745024], [-0.24569164153504505, 0.060628327691353984, 0.6395716761932524, 0.2038388857207813, 0.05030630416291329], [-0.324786293836283, 0.18320488364180873, -0.6304823324359007, -0.08617833527747312, 0.5562222857348684], [-0.31804615253052393, 0.16893747848274307, 0.6046808168685933, 0.37376581575370316, -0.1532720152354209], [-0.2548440350178884, 0.2197773470263299, 0.6505401971683515, 1.6327685731139723, -0.9664990250431387], [-0.3796416914755952, 0.19181004728176793, 0.872581411993793, -0.3748578608633153, 0.24105729971912582], [-0.28652028425317544, 0.28612213383282564, 0.35207946481812463, 0.47603001101092224, -0.12084792315754914]], NamedTuple[(n_steps = 31, is_accept = true, acceptance_rate = 0.8709895194259121, log_density = -115.0180690241447, hamiltonian_energy = 120.88247979334828, hamiltonian_energy_error = 0.04336807248662922, max_hamiltonian_energy_error = 0.3188214277473804, tree_depth = 5, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false), (n_steps = 3, is_accept = true, acceptance_rate = 0.9920259097261122, log_density = -113.46257964375141, hamiltonian_energy = 115.65868315558247, hamiltonian_energy_error = -0.2342318558624612, max_hamiltonian_energy_error = -0.23624714028807148, tree_depth = 2, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false), (n_steps = 31, is_accept = true, acceptance_rate = 0.8333921555596525, log_density = -113.53478281683101, hamiltonian_energy = 117.48733342193401, hamiltonian_energy_error = 0.08783279354274498, max_hamiltonian_energy_error = 0.44884859435951796, tree_depth = 4, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false), (n_steps = 27, is_accept = true, acceptance_rate = 0.940251862956666, log_density = -113.6879200680775, hamiltonian_energy = 115.93281605239446, hamiltonian_energy_error = -0.00429630823963123, max_hamiltonian_energy_error = 0.18183556421061553, tree_depth = 4, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false), (n_steps = 15, is_accept = true, acceptance_rate = 0.7431113552983549, log_density = -114.981053745235, hamiltonian_energy = 118.59374747054991, hamiltonian_energy_error = 0.23369502747790705, max_hamiltonian_energy_error = 0.7111071055572324, tree_depth = 3, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false), (n_steps = 3, is_accept = true, acceptance_rate = 1.0, log_density = -113.21947534920044, hamiltonian_energy = 115.55201462555348, hamiltonian_energy_error = -0.29781409074089993, max_hamiltonian_energy_error = -0.29781409074089993, tree_depth = 2, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false), (n_steps = 3, is_accept = true, acceptance_rate = 0.5658342462350628, log_density = -117.02234080658233, hamiltonian_energy = 118.11282630870969, hamiltonian_energy_error = 0.654977094142069, max_hamiltonian_energy_error = 0.654977094142069, tree_depth = 2, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false), (n_steps = 63, is_accept = true, acceptance_rate = 0.9765225110003312, log_density = -115.07310600913604, hamiltonian_energy = 119.45070554348854, hamiltonian_energy_error = -0.18216928954855405, max_hamiltonian_energy_error = -0.42840059212852566, tree_depth = 6, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false), (n_steps = 31, is_accept = true, acceptance_rate = 1.0, log_density = -112.89244380137761, hamiltonian_energy = 117.4346888295016, hamiltonian_energy_error = -0.5108016630578192, max_hamiltonian_energy_error = -0.5135361555119431, tree_depth = 4, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false), (n_steps = 3, is_accept = true, acceptance_rate = 0.6492557806092548, log_density = -115.64666930902186, hamiltonian_energy = 117.10088397620035, hamiltonian_energy_error = 0.5594216650310528, max_hamiltonian_energy_error = 0.5594216650310528, tree_depth = 2, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false) … (n_steps = 7, is_accept = true, acceptance_rate = 0.8275074170798832, log_density = -113.96744382049317, hamiltonian_energy = 114.92645906423823, hamiltonian_energy_error = 0.22950829312134147, max_hamiltonian_energy_error = 0.3005555444625969, tree_depth = 2, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false), (n_steps = 7, is_accept = true, acceptance_rate = 0.8846501055440908, log_density = -113.37822949874426, hamiltonian_energy = 116.05560222659788, hamiltonian_energy_error = -0.11593672209505712, max_hamiltonian_energy_error = 0.4027003865468828, tree_depth = 2, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false), (n_steps = 63, is_accept = true, acceptance_rate = 0.8993108771394184, log_density = -113.30848092252216, hamiltonian_energy = 115.26504709665689, hamiltonian_energy_error = 0.047565775654362596, max_hamiltonian_energy_error = 0.19754888261338976, tree_depth = 6, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false), (n_steps = 19, is_accept = true, acceptance_rate = 0.9157967664790966, log_density = -112.91581812734576, hamiltonian_energy = 115.38153269850581, hamiltonian_energy_error = -0.08550540291982145, max_hamiltonian_energy_error = 0.26634865673210584, tree_depth = 4, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false), (n_steps = 3, is_accept = true, acceptance_rate = 0.8954901290303567, log_density = -114.3544520512127, hamiltonian_energy = 114.66304066338407, hamiltonian_energy_error = 0.18235654691504521, max_hamiltonian_energy_error = 0.18235654691504521, tree_depth = 2, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false), (n_steps = 43, is_accept = true, acceptance_rate = 0.9896474148031109, log_density = -112.6399021991975, hamiltonian_energy = 115.0175950530701, hamiltonian_energy_error = -0.2762805054382369, max_hamiltonian_energy_error = -0.30933275408025906, tree_depth = 5, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false), (n_steps = 47, is_accept = true, acceptance_rate = 0.9953531105935834, log_density = -112.6190370790195, hamiltonian_energy = 113.87229453890576, hamiltonian_energy_error = 0.01236215219913106, max_hamiltonian_energy_error = -0.02337657681819394, tree_depth = 5, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false), (n_steps = 15, is_accept = true, acceptance_rate = 0.7499030983385524, log_density = -115.67962867112682, hamiltonian_energy = 117.28103524904927, hamiltonian_energy_error = 0.46271174780106605, max_hamiltonian_energy_error = 0.674228357157233, tree_depth = 3, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false), (n_steps = 3, is_accept = true, acceptance_rate = 0.9298225896256996, log_density = -112.78616117788069, hamiltonian_energy = 117.1943704492993, hamiltonian_energy_error = -0.4830136943647574, max_hamiltonian_energy_error = -0.4830136943647574, tree_depth = 2, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false), (n_steps = 31, is_accept = true, acceptance_rate = 0.9075485875440757, log_density = -113.69181578372384, hamiltonian_energy = 114.8567984265368, hamiltonian_energy_error = 0.18963777630962397, max_hamiltonian_energy_error = 0.23284844079107359, tree_depth = 4, numerical_error = false, step_size = 0.8229704320758751, nom_step_size = 0.8229704320758751, is_adapt = false)])