In [1]:
import pymc
import numpy as np
data = np.array([1, 1, 1, 1, 1, 1, 1, 0, 1])
beta = pymc.Beta('beta', 1, 1)
ber = pymc.Bernoulli('ber', beta, observed = True, value = data)
mcmc = pymc.MCMC([beta, ber])
mcmc.sample(1000, 500, 1)
np.mean(mcmc.trace("beta")[:])
Out[1]:
In [ ]: