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
Implements a simple Nutpie style adaptation (using both positions and gradients, but not changing the schedule). (#473)
* initial changes to get a working demo
* fix tests, add new ones, and add documentation
* fix type
* fix some stray tests
* delete tmp folder with demo
* address review comments
* reference interface refactor issue
* refactor and fix test rng handling
* improve docstring for NutpieVar
* remove superfluous white space
* fix JET tests
* add entry to history, bump version
* fix NutpieVar docstring
* increase number of tests for mass matrix adaptation
---------
Co-authored-by: Markus Hauru <[email protected]>
Copy file name to clipboardExpand all lines: HISTORY.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,12 @@
1
1
# AdvancedHMC Changelog
2
2
3
+
## 0.8.4
4
+
5
+
- Introduces an experimental way to improve the *diagonal* mass matrix adaptation using gradient information (similar to [nutpie](https://github.com/pymc-devs/nutpie)),
6
+
currently to be initialized for a `metric` of type `DiagEuclideanMetric`
7
+
via `mma = AdvancedHMC.NutpieVar(size(metric); var=copy(metric.M⁻¹))`
8
+
until a new interface is introduced in an upcoming breaking release to specify the method of adaptation.
9
+
3
10
## 0.8.0
4
11
5
12
- 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)`).
Copy file name to clipboardExpand all lines: docs/src/api.md
+8-4Lines changed: 8 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,11 +31,15 @@ where `ϵ` is the step size of leapfrog integration.
31
31
### Adaptor (`adaptor`)
32
32
33
33
- Adapt the mass matrix `metric` of the Hamiltonian dynamics: `mma = MassMatrixAdaptor(metric)`
34
-
34
+
35
35
+ This is lowered to `UnitMassMatrix`, `WelfordVar` or `WelfordCov` based on the type of the mass matrix `metric`
36
+
+ There is an experimental way to improve the *diagonal* mass matrix adaptation using gradient information (similar to [nutpie](https://github.com/pymc-devs/nutpie)),
37
+
currently to be initialized for a `metric` of type `DiagEuclideanMetric`
38
+
via `mma = AdvancedHMC.NutpieVar(size(metric); var=copy(metric.M⁻¹))`
39
+
until a new interface is introduced in an upcoming breaking release to specify the method of adaptation.
36
40
37
41
- Adapt the step size of the leapfrog integrator `integrator`: `ssa = StepSizeAdaptor(δ, integrator)`
38
-
42
+
39
43
+ It uses Nesterov's dual averaging with `δ` as the target acceptance rate.
40
44
- Combine the two above *naively*: `NaiveHMCAdaptor(mma, ssa)`
41
45
- Combine the first two using Stan's windowed adaptation: `StanHMCAdaptor(mma, ssa)`
@@ -60,12 +64,12 @@ sample(
60
64
Draw `n_samples` samples using the kernel `κ` under the Hamiltonian system `h`
61
65
62
66
- The randomness is controlled by `rng`.
63
-
67
+
64
68
+ If `rng` is not provided, the default random number generator (`Random.default_rng()`) will be used.
65
69
66
70
- The initial point is given by `θ`.
67
71
- The adaptor is set by `adaptor`, for which the default is no adaptation.
68
-
72
+
69
73
+ It will perform `n_adapts` steps of adaptation, for which the default is `1_000` or 10% of `n_samples`, whichever is lower.
0 commit comments