Skip to content

Commit da10a5a

Browse files
committed
simplified svol example
1 parent dc966b7 commit da10a5a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

examples/stochastic_volatility.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
sd, lsd = model.TransformedVar(
2121
'sd', Exponential(1./.02),
22-
transforms.log, testval = -2.3)
22+
transforms.log, testval = -2.5)
2323

2424
nu = Var('nu', Exponential(1./10))
2525

@@ -40,6 +40,7 @@ def hessian(q, nusd):
4040

4141
return csc_matrix(h)
4242

43+
4344
from scipy import optimize
4445
s = find_MAP(model, vars = [lvol], fmin = optimize.fmin_l_bfgs_b)
4546
s = find_MAP(model, s, vars = [lsd, nu])
@@ -49,6 +50,6 @@ def hessian(q, nusd):
4950

5051
s2 = trace.point(-1)
5152

52-
step = hmc_step(model, model.vars, hessian(s2, 6), trajectory_length = 4)
53-
trace, _,t = sample(8000, step, trace = trace)
53+
step = hmc_step(model, model.vars, hessian(s2, 6), trajectory_length = 4.)
54+
trace, _,t = sample(4000, step, trace = trace)
5455

0 commit comments

Comments
 (0)