Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Marginalize over latent variables #21

@ricardoV94

Description

@ricardoV94

I wonder whether it would be possible to rewrite the logp graphs to marginalize over finite discrete variables, indicated by the user (not necessarily all that are in the graph).

x_rv = at.random.bernoulli(0.7)
y_rv = at.normal([0, 1], [1, 1])[x_rv]
y = y_rv.type()

logp = joint_logprob(y_rv, {y_rv: y}, marginalize={x_rv})

Whose logp would be p(y_rv=y | x_rv=0) * p(x_rv=0) + p(y_rv=y | x_rv=1) * p(x_rv=1)

This is straightforward(ish) if the marginalization happens just above the requested variable (e.g., y_rv), but gets more complicated if it happens at the top of a deeper graph.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgraph rewritingInvolves the implementation of rewrites to Aesara graphshelp wantedExtra attention is neededimportantThis label is used to indicate priority over things not given this label

    Type

    No type

    Projects

    Status

    Graph

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions