Slow initialization? (First time user)

I have used OpenBUGS for Bayesian inference in the classroom, and I would like to switch to PyMC for practical application.

I am trying out a number of examples from the documentation, and it’s going well so far.

However, it seems like I have to wait a really long time to “initialize” the sampler. This is the simplest example I want to run:

heads = np.array([0, 0, 0, 0, 0])
with pm.Model() as model:
    p = pm.Uniform('p',0,1)
    likelihood = pm.Bernoulli('y',p=p, observed=heads)
    posterior = pm.sample(10000,start={'p': 0.5},tune=2500)

Once I get to the loading bar, the 40K samples run pretty quickly (seconds) but it takes minutes to even get to that point.

Is there something I’m missing? Can I be setting myself up to do this faster or is it always going to be this slow?


1 Like


Are you using v3 or v4 (beta)? And what platform are you on?

V3. I am running on a Windows machine and scripting on Jupiter

1 Like

Strange. Initialization is much faster than sampling for me. The first thing I think I might suggest is trying to do something similar but outside of a notebook. I have no particular reason to think that jupyter is the problem, but weird things do occur when you’re running a notebook that is interacting with a kernel, etc. etc.

1 Like