Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
7883d49
Add Riemannian manifold HMC
ErikQQY May 5, 2025
d0191cf
Merge branch 'main' into qqy/NEW_RMHMC
ErikQQY May 10, 2025
1fcdd09
Format
ErikQQY May 10, 2025
5f9592f
Merge branch 'main' into qqy/NEW_RMHMC
ErikQQY Jun 29, 2025
567e2a8
format
ErikQQY Jun 29, 2025
6df40b5
Merge branch 'main' into qqy/NEW_RMHMC
ErikQQY Nov 21, 2025
c9e6b0a
Include Riemannian HMC tests
ErikQQY Nov 21, 2025
26266c7
Merge branch 'main' into ns/rhmc
nsiccha Dec 16, 2025
280ca15
start minimal refactor for merging into main
nsiccha Dec 18, 2025
6421310
Implement unified Riemannian metric
THargreaves Jan 7, 2026
840cd2d
Fix for compilation
J-Price-3 Jan 13, 2026
cbba891
Fix dHdr to allow Generalised NUTS
J-Price-3 Jan 13, 2026
0c9e825
Add basic validity test for RHMC
J-Price-3 Jan 13, 2026
909d72a
Format
J-Price-3 Jan 14, 2026
642585f
Add funnel test and fix gaussian validation test
J-Price-3 Jan 17, 2026
effb115
Format test/riemannian.jl
J-Price-3 Jan 17, 2026
cb43e2a
Update validation tests to both use w1 distance and a more logical to…
J-Price-3 Jan 19, 2026
3680b87
Reduce validation test tolerance
J-Price-3 Jan 19, 2026
7e91495
Increase validation test tolerance slightly
J-Price-3 Jan 19, 2026
af46f2e
Prevent test type instability
J-Price-3 Jan 21, 2026
41267f1
Fix tests
J-Price-3 Jan 21, 2026
c9d3016
Fix flaky test
J-Price-3 Jan 21, 2026
6494b34
Fix flaky test (I promise it works this time)
J-Price-3 Jan 22, 2026
037aac1
Merge remote-tracking branch 'origin/main' into th/unified-rhmc
THargreaves May 19, 2026
92ac4c6
Make SoftAbs numerically stable
THargreaves May 19, 2026
efd0824
Formatting
THargreaves May 19, 2026
3f7de10
Cached G_eval for use in phasepoint
THargreaves May 19, 2026
21f48c2
Add error for mass-matrix adaptation with RHMC
THargreaves May 19, 2026
686d1a6
Add warning for partial refreshment with RHMC
THargreaves May 19, 2026
f211632
Correct update function signatures
THargreaves May 19, 2026
ad06769
Improve RiemannianMetric type stability
THargreaves May 19, 2026
60291d6
Updated documentation
THargreaves May 19, 2026
632a71d
Deprecate old RHMC interface
THargreaves May 25, 2026
b14dbad
Improve caching for generalised leapfrog integrator
THargreaves May 25, 2026
7677bc3
Fix MacOS unit test by removing warm-up samples
THargreaves May 25, 2026
95788e9
Add canonicalisation of softabs metric
THargreaves May 25, 2026
f6aff9c
Merge remote-tracking branch 'origin/main' into th/unified-rhmc
yebai Jul 9, 2026
8574988
Apply suggestions from code review
yebai Jul 9, 2026
f38d55a
Merge remote-tracking branch 'origin/main' into th/unified-rhmc
yebai Jul 9, 2026
c4314f3
Drop MCMCLogDensityProblems test dep; inline toy targets
yebai Jul 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ This modularity means that different HMC variants can be easily constructed by c
- Diagonal metric: `DiagEuclideanMetric(dim)`
- Dense metric: `DenseEuclideanMetric(dim)`

where `dim` is the dimensionality of the sampling space.
where `dim` is the dimension of the sampling space.

Furthermore, there is now an experimental dense Riemannian metric implementation, specifiable as `DenseRiemannianMetric(dim, premetric, premetric_sensitivities, metric_map=IdentityMap())`, with

- `dim`: again the dimension of the sampling space,
- `premetric`: a function which, for a given posterior position `pos`, computes either
a) a symmetric, **positive definite** matrix acting as the position dependent Riemannian metric (if `metric_map = IdentityMap()`), or
b) a symmetric, **not necessarily positive definite** matrix acting as the position dependent Riemannian metric after being passed through the `metric_map` argument, which will have to ensure that its return value *is* positive definite (like `metric_map = SoftAbsMap(alpha)`),
- `premetric_sensitivities`: a function which, again for a given posterior position `pos`, computes the sensitivities with respect to this position of the **`premetric`** function,
- `metric_map=IdentityMap()`: a function which takes in `premetric(pos)` and returns a symmetric positive definite matrix. Provided options are `IdentityMap()` or `SoftAbsMap(alpha)`, with the `SoftAbsMap` type allowing to work directly with the `premetric` returning the Hessian of the log density function, which generally is not guaranteed to be positive definite..

### [Integrator (`integrator`)](@id integrator)

Expand Down
31 changes: 28 additions & 3 deletions src/AdvancedHMC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,20 @@ module AdvancedHMC

using Statistics: mean, var, middle
using LinearAlgebra:
Symmetric, UpperTriangular, mul!, ldiv!, dot, I, diag, cholesky, UniformScaling
Symmetric,
UpperTriangular,
Diagonal,
mul!,
ldiv!,
dot,
I,
diag,
cholesky,
UniformScaling,
logdet,
tr,
eigen,
diagm
using StatsFuns: logaddexp, logsumexp, loghalf
using Random: Random, AbstractRNG
using ProgressMeter: ProgressMeter
Expand Down Expand Up @@ -40,7 +53,7 @@ struct GaussianKinetic <: AbstractKinetic end
export GaussianKinetic

include("metric.jl")
export UnitEuclideanMetric, DiagEuclideanMetric, DenseEuclideanMetric
export UnitEuclideanMetric, DiagEuclideanMetric, DenseEuclideanMetric, DenseRiemannianMetric

include("hamiltonian.jl")
export Hamiltonian
Expand All @@ -50,6 +63,13 @@ export Leapfrog, JitteredLeapfrog, TemperedLeapfrog
include("riemannian/integrator.jl")
export GeneralizedLeapfrog

include("riemannian/metric.jl")
export RiemannianMetric, SoftAbsRiemannianMetric
# Deprecated exports (for backward compatibility)
export IdentityMap, SoftAbsMap, DenseRiemannianMetric

include("riemannian/hamiltonian.jl")

include("trajectory.jl")
export Trajectory,
HMCKernel,
Expand All @@ -72,7 +92,12 @@ export find_good_eps
include("adaptation/Adaptation.jl")
using .Adaptation
import .Adaptation:
StepSizeAdaptor, MassMatrixAdaptor, StanHMCAdaptor, NesterovDualAveraging, NoAdaptation, PositionOrPhasePoint
StepSizeAdaptor,
MassMatrixAdaptor,
StanHMCAdaptor,
NesterovDualAveraging,
NoAdaptation,
PositionOrPhasePoint

# Helpers for initializing adaptors via AHMC structs

Expand Down
Loading
Loading