Skip to content

Fix equality checking for instances of rv_discrete #121

Description

@fsaad
>>> from sppl.distributions import rv_discrete
>>> from sppl.spe import DiscreteLeaf
>>> d1 = rv_discrete(values=((1, 2), (.5, .5)))
>>> d2 = rv_discrete(values=((1, 2), (.8, .2)))
>>> l1 = Id("X") >> a
>>> l2 = Id("X") >> b
>>> l1 == l2
True

The problem is that scipy does not store the values under the kwds in the frozen rv_discrete object, that is

>>> l1.dist.kwds
{}
>>> l2.dist.kwds
{}

and so the equality logic checking passes:
https://github.com/probcomp/sppl/blob/efff34fb3d3703247dd7001c36970069c5ac3825/src/spe.py#L828-L836

The kwds field is populated by scipy for all other distributions norm, poisson, etc.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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