Thanks, this works!
I was also able to use theano's ifelse:
from theano.ifelse import ifelse
with pm.Model() as model:
weekend = pm.Bernoulli('weekend', 2/7)
rate = ifelse(weekend, 3, 10)
bus = pm.Poisson('buses', mu=rate, observed=4)
trace = pm.sample(10000)
Indeed, the docs for Deterministic say that the var parameter should be a “theano variable”:
pymc3.model.Deterministic(name, var, model=None)¶
Create a named deterministic variable
Parameters
name str
var theano variables
But perhaps it should feature more prominently in the docs (even if this is self-evident for someone who understands how PyMC works under the hood).