Skip to content

Composing categorical distributions #1790

Closed
@rtbs-dev

Description

@rtbs-dev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions