AdaptiveMALA¶
MALA with automatic step-size tuning via log-space adaptation targeting 57.4% acceptance.
Requires grad_log_likelihood (and optionally grad_log_prior) on the Problem.
import mcmckit as mc
sampler = mc.AdaptiveMALA(
n_samples=15_000,
initial_step_size=0.05, # can start far from optimal
target_rate=0.574,
gamma=0.6,
)
result = sampler.run(problem_with_grad, x0=[0.0, 0.0])
print(f"final step size: {sampler.step_size:.4f}")
AdaptiveMALA ¶
Bases: BaseSampler
Adaptive MALA: MALA with automatic step-size tuning.
Uses the same gradient-biased proposal as MALA but adapts the scalar step size ε during sampling to drive the acceptance rate toward the theoretically optimal target of 0.574 for MALA.
Adaptation rule (log-scale stochastic approximation):
log(ε_{i+1}) = log(ε_i) + η_i (α_i - α*)
where η_i = (i+1)^{-γ} is a decaying schedule and α* = 0.574.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_samples
|
int
|
Number of samples to collect when calling run(). |
required |
initial_step_size
|
float
|
Starting value for ε. The adaptation will correct a bad initial guess, but a reasonable starting point (e.g. 0.1–1.0) helps. |
0.1
|
target_rate
|
float
|
Target acceptance rate α*. Default 0.574 (optimal for MALA). |
0.574
|
gamma
|
float
|
Decay exponent for the adaptation schedule η_i = (i+1)^{-γ}. Must be in (0.5, 1]. Default 0.6. |
0.6
|
Notes
Requires problem.has_grad == True.
Source code in mcmckit/samplers/adaptive_mala.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
Attributes¶
Methods:¶
step ¶
Perform one adaptive MALA step.
Source code in mcmckit/samplers/adaptive_mala.py
run ¶
Initialize and run for n_samples steps, returning a Result.
get_result ¶
Return a Result from all samples collected so far.