I’m trying to run the demonstration notebook about DPMMs: Dirichlet process mixtures for density estimation — PyMC3 3.10.0 documentation
After getting the version PyMC3
right (v3.9.0), when I run the following code cell in the notebook linked above:
with pm.Model() as model:
alpha = pm.Gamma("alpha", 1.0, 1.0)
beta = pm.Beta("beta", 1.0, alpha, shape=K)
w = pm.Deterministic("w", stick_breaking(beta))
tau = pm.Gamma("tau", 1.0, 1.0, shape=K)
lambda_ = pm.Gamma("lambda_", 10.0, 1.0, shape=K)
mu = pm.Normal("mu", 0, tau=lambda_ * tau, shape=K)
obs = pm.NormalMixture(
"obs", w, mu, tau=lambda_ * tau, observed=old_faithful_df.std_waiting.values
)
The TypeError
:
TypeError Traceback (most recent call last) <ipython-input-28-3e5d2cb5dec6> in <module> 7 lambda_ = pm.Gamma("lambda_", 10.0, 1.0, shape=K) 8 mu = pm.Normal("mu", 0, tau=lambda_ * tau, shape=K) ----> 9 obs = pm.NormalMixture( 10 "obs", w, mu, tau=lambda_ * tau, observed=old_faithful_df.std_waiting.values 11 )
…
~/anaconda3/envs/ve1/lib/python3.8/site-packages/theano/compile/function/pfunc.py in rebuild_collect_shared(outputs, inputs, replace, updates, rebuild_strict, copy_inputs_over, no_default_updates) 223 cloned_outputs.append(Out(cloned_v, borrow=v.borrow)) 224 else: --> 225 raise TypeError( 226 "Outputs must be theano Variable or " 227 "Out instances. Received " + str(v) + " of type " + str(type(v))
TypeError: Outputs must be theano Variable or Out instances. Received Shape.0 of type <class 'theano.tensor.var.TensorVariable'>
Anyone else encounter this and know how to troubleshoot?