@@ -82,29 +82,26 @@ function step(
82
82
η, α = spl. alg. learning_rate, spl. alg. momentum_decay
83
83
spl. info[:eval_num ] = 0
84
84
85
- @debug " X-> R..."
86
85
if spl. selector. tag != :default
87
86
link! (vi, spl)
88
87
model (vi, spl)
89
88
end
90
89
91
- @debug " recording old variables... "
90
+ # Record old variables
92
91
θ, v = vi[spl], spl. info[:v ]
93
92
_, grad = gradient_logp (θ, vi, model, spl)
94
93
verifygrad (grad)
95
94
96
- # Implements the update equations from (15) of Chen et al. (2014).
97
- @debug " update latent variables and velocity..."
95
+ # Update latent variables and velocity according to (15) of Chen et al. (2014)
98
96
θ .+ = v
99
97
v .= (1 - α) .* v .+ η .* grad .+ rand .(Normal .(zeros (length (θ)), sqrt (2 * η * α)))
100
98
101
- @debug " saving new latent variables... "
99
+ # Save new latent variables
102
100
vi[spl] = θ
103
101
104
- @debug " R -> X..."
105
102
spl. selector. tag != :default && invlink! (vi, spl)
106
103
107
- @debug " always accept... "
104
+ # Always accept
108
105
return vi, true
109
106
end
110
107
@@ -189,30 +186,28 @@ function step(
189
186
spl. info[:i ] += 1
190
187
spl. info[:eval_num ] = 0
191
188
192
- @debug " compute current step size... "
189
+ # Compute current step size
193
190
γ = .35
194
191
ϵ_t = spl. alg. ϵ / spl. info[:i ]^ γ # NOTE: Choose γ=.55 in paper
195
192
mssa = spl. info[:adaptor ]. ssa
196
193
mssa. state. ϵ = ϵ_t
197
194
198
- @debug " X-> R..."
199
195
if spl. selector. tag != :default
200
196
link! (vi, spl)
201
197
model (vi, spl)
202
198
end
203
199
204
- @debug " recording old variables... "
200
+ # Record old variables
205
201
θ = vi[spl]
206
202
_, grad = gradient_logp (θ, vi, model, spl)
207
203
verifygrad (grad)
208
204
209
- @debug " update latent variables... "
205
+ # Update latent variables
210
206
θ .+ = ϵ_t .* grad ./ 2 .- rand .(Normal .(zeros (length (θ)), sqrt (ϵ_t)))
211
207
212
- @debug " always accept... "
208
+ # Always accept
213
209
vi[spl] = θ
214
210
215
- @debug " R -> X..."
216
211
spl. selector. tag != :default && invlink! (vi, spl)
217
212
218
213
return vi, true
0 commit comments