Hi All,
I have a Normal Mixture model. When I do the sampling I get this error:
File "/usr/local/lib/python2.7/dist-packages/pymc3/sampling.py", line 439, in sample
trace = _mp_sample(**sample_args)
File "/usr/local/lib/python2.7/dist-packages/pymc3/sampling.py", line 1032, in _mp_sample
traces = Parallel(n_jobs=cores, mmap_mode=None)(jobs)
TypeError: __init__() got an unexpected keyword argument 'mmap_mode'
My version of
python: 2.7.16
pymc3: 3.6
scipy: 1.2.1
numpy: 1.15.4
theano: 1.0.4
Ubuntu:
Distributor ID: | Ubuntu |
---|---|
Description: | Ubuntu 14.04.3 LTS |
Release: | 14.04 |
Codename: | trusty |
The code that generates the error:
def test2():
SEED = 383561
np.random.seed(SEED) # from random.org, for reproducibility
N = 1000
W = np.array([0.35, 0.4, 0.25])
MU = np.array([0., 2., 5.])
SIGMA = np.array([0.5, 0.5, 1.])
component = np.random.choice(MU.size, size=N, p=W)
x = np.random.normal(MU[component], SIGMA[component], size=N)
idx_arr = []
with pm.Model() as model:
k = 3
arr = []
for j in range(k):
arr.append(pm.Uniform('a'+str(j),lower=0,upper=0.99))
w = pm.Dirichlet('w', a=tt.stack([arr[i] for i in range(k)]), shape=k)
du = pm.DiscreteUniform('du',lower=0, upper=1,shape=k)
idx_arr = []
for i in range(k):
if du[i]:
idx_arr.append(i)
mu = pm.Normal('mu', 0., 10., shape=k)
tau = pm.Gamma('tau', 1., 1., shape=k)
x_obs = pm.NormalMixture('x_obs', tt.stack([ w[h] for h in idx_arr ]), tt.stack([ mu[h] for h in idx_arr ]), tau=tt.stack([ tau[h] for h in idx_arr ]), observed=x)
with model:
trace = pm.sample(3000,n_init=10000, tune=500, random_seed=SEED)[1000:]
Any idea what the error is about?
Thanks