Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix equality checking for instances of rv_discrete #121

Open
fsaad opened this issue Jan 31, 2022 · 0 comments
Open

Fix equality checking for instances of rv_discrete #121

fsaad opened this issue Jan 31, 2022 · 0 comments

Comments

@fsaad
Copy link
Collaborator

fsaad commented Jan 31, 2022

>>> 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant