Skip to content

Commit 473edaf

Browse files
committed
Address reviews
1 parent cd29464 commit 473edaf

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

HISTORY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# AdvancedHMC Changelog
22

3+
## 0.9.0
4+
5+
- To compute the negative energy of a Hamiltonian `h` with parameter `θ` and momentum `r`, use `neg_energy(h, θ, r)` instead of `neg_energy(h, r, θ)`, which is now consistent with the common usage like `phasepoint(h, θ, r)`.
6+
37
## 0.8.0
48

59
- To make an MCMC transtion from phasepoint `z` using trajectory `τ`(or HMCKernel `κ`) under Hamiltonian `h`, use `transition(h, τ, z)` or `transition(rng, h, τ, z)`(if using HMCKernel, use `transition(h, κ, z)` or `transition(rng, h, κ, z)`).

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "AdvancedHMC"
22
uuid = "0bf59076-c3b1-5ca4-86bd-e02cd72cde3d"
3-
version = "0.8.0"
3+
version = "0.9.0"
44

55
[deps]
66
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"

src/riemannian/hamiltonian.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ function step(
7474
θ_full = copy(θ_init)
7575
term_1 = ∂H∂r(h, θ_init, r_half).gradient # unchanged across the loop
7676
for j in 1:(lf.n)
77-
θ_full = θ_init + ϵ / 2 * (term_1 + ∂H∂r(h, θ_full, r_half).gradient)
77+
grad_r = ∂H∂r(h, θ_full, r_half).gradient
78+
θ_full = θ_init + ϵ / 2 * (term_1 + grad_r)
7879
# println("θ_full :", θ_full)
7980
end
8081
#! Eq (18) of Girolami & Calderhead (2011)

src/riemannian/integrator.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ function step(
7676
θ_full = θ_init
7777
term_1 = ∂H∂r(h, θ_init, r_half).gradient # unchanged across the loop
7878
for j in 1:(lf.n)
79-
θ_full = θ_init + ϵ / 2 * (term_1 + ∂H∂r(h, θ_full, r_half).gradient)
79+
grad_r = ∂H∂r(h, θ_full, r_half).gradient
80+
θ_full = θ_init + ϵ / 2 * (term_1 + grad_r)
8081
end
8182
# eq (18) of Girolami & Calderhead (2011)
8283
(; value, gradient) = ∂H∂θ(h, θ_full, r_half)

0 commit comments

Comments
 (0)