You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am new to PYMC3. While learning, I did a Mixture Model tutorial, outlined in the book "Probabilistic Programming & Bayesian Methods for Hackers". I believe I am doing exactly what was outlined in the tutorial, however my sampling does not start or is very slow. I tried various permutations, as below, without success. Note, the data size is 300. Could someone tell me what I am doing wrong?
with pm.Model() as model:
# Which normal distribution?
p1 = pm.Uniform('p1', 0, 1)
p2 = 1 - p1
p = T.stack([p1, p2])
assign = pm.Categorical('assign', p, shape = data.values.shape[0], testval = np.random.randint
(0, 2, data.values.shape[0]))
# Priors
sdevs = pm.Uniform('sdevs', 0, 100, shape = 2)
means = pm.Normal('means', mu = np.array([120, 190]), sd = np.array([10, 10]), shape = 2)
means_ = pm.Deterministic("means_", means[assign])
sdevs_ = pm.Deterministic("sdevs_", sdevs[assign])
# Data
obs = pm.Normal('obs', mu = means_, sd = sdevs_, observed = data.values)
First, I let PyMC decide which routines to use and saw no results in 5 hours:
with model:
trace = pm.sample(25000)
Multiprocess sampling (4 chains in 4 jobs)
CompoundStep
I also tried to be more prescriptive and attempted the following, but the sampler is very slow:
with model:
start = find_MAP(model = model)
step1 = pm.Metropolis(vars = [p, sdevs, means])
step2 = pm.ElemwiseCategorical(vars = [assign])
trace = pm.sample(25000, start = start, step = [step1, step2])
logp = -4.7305e+05, ||grad|| = 299.51: 100%|███████████████████████████████████████████| 39/39 [01:37<00:00, 2.51s/it]
C:\Users\bikim\AppData\Local\conda\conda\envs\pymc3p36\lib\site-packages\ipykernel_launcher.py:6: DeprecationWarning: ElemwiseCategorical is deprecated, switch to CategoricalGibbsMetropolis.
Multiprocess sampling (4 chains in 4 jobs)
CompoundStep
Reading this issue further, I would recommend posting to the Discourse site rather than as an issue, as this is a usage question rather than a bug report.
I am new to PYMC3. While learning, I did a Mixture Model tutorial, outlined in the book "Probabilistic Programming & Bayesian Methods for Hackers". I believe I am doing exactly what was outlined in the tutorial, however my sampling does not start or is very slow. I tried various permutations, as below, without success. Note, the data size is 300. Could someone tell me what I am doing wrong?
with pm.Model() as model:
# Which normal distribution?
p1 = pm.Uniform('p1', 0, 1)
p2 = 1 - p1
p = T.stack([p1, p2])
assign = pm.Categorical('assign', p, shape = data.values.shape[0], testval = np.random.randint
(0, 2, data.values.shape[0]))
# Priors
sdevs = pm.Uniform('sdevs', 0, 100, shape = 2)
means = pm.Normal('means', mu = np.array([120, 190]), sd = np.array([10, 10]), shape = 2)
means_ = pm.Deterministic("means_", means[assign])
sdevs_ = pm.Deterministic("sdevs_", sdevs[assign])
# Data
obs = pm.Normal('obs', mu = means_, sd = sdevs_, observed = data.values)
First, I let PyMC decide which routines to use and saw no results in 5 hours:
with model:
trace = pm.sample(25000)
Multiprocess sampling (4 chains in 4 jobs)
CompoundStep
I also tried to be more prescriptive and attempted the following, but the sampler is very slow:
with model:
start = find_MAP(model = model)
step1 = pm.Metropolis(vars = [p, sdevs, means])
step2 = pm.ElemwiseCategorical(vars = [assign])
trace = pm.sample(25000, start = start, step = [step1, step2])
logp = -4.7305e+05, ||grad|| = 299.51: 100%|███████████████████████████████████████████| 39/39 [01:37<00:00, 2.51s/it]
C:\Users\bikim\AppData\Local\conda\conda\envs\pymc3p36\lib\site-packages\ipykernel_launcher.py:6: DeprecationWarning: ElemwiseCategorical is deprecated, switch to CategoricalGibbsMetropolis.
Multiprocess sampling (4 chains in 4 jobs)
CompoundStep
This should be an easy problem. I appreciate any insight into what I am doing wrong.
The text was updated successfully, but these errors were encountered: