Skip to content

Commit 5ecc539

Browse files
author
Junpeng Lao
committed
fixed grach_example.py
depends on #2277 by @aseyboldt
1 parent 142289f commit 5ecc539

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

pymc3/examples/garch_example.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,10 @@ def get_garch_model():
3838
shape = r.shape
3939

4040
with Model() as garch:
41-
alpha1 = Normal('alpha1', mu=np.zeros(shape=shape),
42-
sd=np.ones(shape=shape), shape=shape)
41+
alpha1 = Normal('alpha1', mu=0., sd=1., shape=shape)
4342
BoundedNormal = Bound(Normal, upper=(1 - alpha1))
44-
beta1 = BoundedNormal('beta1',
45-
mu=np.zeros(shape=shape),
46-
sd=1e6 * np.ones(shape=shape),
47-
shape=shape)
48-
mu = Normal('mu', mu=np.zeros(shape=shape),
49-
sd=1e6 * np.ones(shape=shape), shape=shape)
43+
beta1 = BoundedNormal('beta1', mu=0., sd=1e6, shape=shape)
44+
mu = Normal('mu', mu=0., sd=1e6, shape=shape)
5045
theta = tt.sqrt(alpha0 + alpha1 * tt.pow(r - mu, 2) +
5146
beta1 * tt.pow(sigma1, 2))
5247
Normal('obs', mu, sd=theta, observed=r)
@@ -57,7 +52,7 @@ def run(n=1000):
5752
if n == "short":
5853
n = 50
5954
with get_garch_model():
60-
tr = sample(n, n_init=10000)
55+
tr = sample(n, init=None)
6156
return tr
6257

6358

0 commit comments

Comments
 (0)