Skip to content

Implement logprob inference for binary operations #6633

@ricardoV94

Description

@ricardoV94

Description

Using CDFs it should be simple to derive the logp of graphs of the form:

import pymc as pm

x = pm.Normal.dist()
y = x < 0.5
pm.logp(y, value=1).eval()  # same as pm.logcdf(x, 0.5)
pm.logp(y, value=0).eval()  # same as log(1 - exp(pm.logcdf(x, 0.5)))

https://github.com/pymc-devs/pymc/blob/main/pymc/logprob/censoring.py includes rewrites of other operations that rely on CDF such as clip, and round.

More challenging, but also fun, would be to support all and any, whose logp should be the sum of the logp that all binary variables evaluate to True or False: any = 1 - all(x==False)

For ordering, and min/max see #6350

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions