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 Reciprocal.ffwd in case that argument is not an integer (sympy chokes) #68

Open
fsaad opened this issue Apr 22, 2020 · 2 comments
Open

Comments

@fsaad
Copy link
Collaborator

fsaad commented Apr 22, 2020

https://github.com/probcomp/sum-product-dsl/blob/95c0daf08af9eea974e0053a45ec9d462e18dbfc/src/transforms.py#L593

Test case

>>> spn = X >> norm(0,1)
>>> spn.transform(Z, 2**(1/X))
>>> samples = spn.sample(10)

The final call will cause sympy to hang, which cannot evaluate two raised to a large Rational, specifically:

2**sympy.Rational(1, samples[0][x])
@fsaad
Copy link
Collaborator Author

fsaad commented Apr 28, 2020

Note that sympy hangs only if x<0; positive is fine.

@fsaad
Copy link
Collaborator Author

fsaad commented Apr 28, 2020

Generally it seems we need to migrate the solver in transforms.py to use python floats, since sympy has unreliable performance for edge cases which will be too complicated to try and track.

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