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

bug in boost libraries used by scipy.stats.beta #1006

Closed
Gabriel-Kissin opened this issue Jul 30, 2023 · 0 comments · Fixed by #1026
Closed

bug in boost libraries used by scipy.stats.beta #1006

Gabriel-Kissin opened this issue Jul 30, 2023 · 0 comments · Fixed by #1026

Comments

@Gabriel-Kissin
Copy link

I've found a bug in a couple of python scipy probability functions which leads to the kernel crashing. In the case of the beta function, the error originates in the source in boost which appears to be at boost.org and on github in one of the lines reading BOOST_MATH_ASSERT(*p_derivative >= 0).

I originally posted this issue at scipy/scipy#18906. But am now reposting the python code here as requested there by @jzmaddock.

import scipy.stats
print([shape_param.domain for shape_param in scipy.stats.beta._shape_info()])
# [[5e-324, inf], [5e-324, inf]]
print(scipy.stats.beta(a=1e-308, b=5).ppf(.2))
# 0.0
print(scipy.stats.beta(a=1e-309, b=5).ppf(.2))
# OverflowError: Error in function boost::math::tgamma<d>(d): Overflow Error
# (raises error, but kernel doesn't crash)
print(scipy.stats.beta(a=1e-323, b=5).ppf(.2))
# KERNEL CRASHES with message: `Assertion failed: *p_derivative >= 0, file  
 ..\..\scipy\_lib\boost/boost/math/special_functions/beta.hpp, line 739`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant