Skip to content

Commit 122d0f4

Browse files
committed
aribtrary stochastic example
1 parent 5f3e906 commit 122d0f4

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

examples/arbitrary_stochastic.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from pymc import *
2+
import numpy as np
3+
with Model() as model:
4+
lam = Exponential('lam', 1)
5+
6+
7+
failure = np.array([0, 1])
8+
value = np.array([1,0])
9+
10+
def logp(failure, value):
11+
return sum(failure*log(lam) - lam*value)
12+
13+
x = DensityDist('x', logp, observed = (failure, value))
14+
15+
start = model.test_point
16+
h = find_hessian(start)
17+
step = Metropolis(model.vars, h)
18+
trace = sample(3000, step, start)

0 commit comments

Comments
 (0)