Description
At the moment there doesn't seem to be a generalized way to compose categorical variables, i.e. have a categorical node inherit from one or more parent categorical nodes.
I've re-implemented a Bayesian Network example from the PMML documentation tutorial (gist notebook here, and original source here).
Currently the only way I can figure out to allow inheritance is to do a nasty theano.tensor.switch()
chain call in a kind of binary boolean tree. The old PyMC2 way is to write an @pymc3.deterministic
decorator in front of a long pre-defined python if, elif, else block (commented out on the gist, after I attempted unsuccessfully to use @theano.compile.ops.as_op()
to bring that way into PyMC3.
There needs to be a way to generally take some set of N parent nodes, with categorical distributions, and have their categorical child "inherit" the probabilities when supplied with an (N+1)-dimensional array of category probabilities.
Preferably this should be done using theano, which lets one use the nicer samplers when available.