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: Test failures due to invalid value encountered in _beta_ppf on M2 mac #20208

Closed
Kai-Striega opened this issue Mar 7, 2024 · 19 comments · Fixed by #20393
Closed

BUG: Test failures due to invalid value encountered in _beta_ppf on M2 mac #20208

Kai-Striega opened this issue Mar 7, 2024 · 19 comments · Fixed by #20393
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.stats
Milestone

Comments

@Kai-Striega
Copy link
Member

Kai-Striega commented Mar 7, 2024

Describe your issue.

The following tests fail with the warning invalid value encountered in _beta_ppf

Reproducing Code Example

`python dev.py test`

Error message

FAILED scipy/stats/tests/test_distributions.py::TestBeta::test_issue_12635 - RuntimeWarning: invalid value encountered in _beta_ppf
FAILED scipy/stats/tests/test_distributions.py::TestBeta::test_issue_12794 - RuntimeWarning: invalid value encountered in _beta_isf
FAILED scipy/stats/tests/test_distributions.py::TestBeta::test_issue_12796 - RuntimeWarning: invalid value encountered in _beta_ppf
FAILED scipy/stats/tests/test_fast_gen_inversion.py::test_rvs_and_ppf[betaprime-args6] - RuntimeWarning: invalid value encountered in _beta_ppf
FAILED scipy/stats/tests/test_distributions.py::TestBetaPrime::test_ppf[0.375-0.25-7.0-0.002036820346115211] - RuntimeWarning: invalid value encountered in _beta_ppf
FAILED scipy/stats/tests/test_fast_gen_inversion.py::test_non_rvs_methods_with_domain - RuntimeWarning: invalid value encountered in _beta_ppf
FAILED scipy/stats/tests/test_fit.py::TestGoodnessOfFit::test_against_filliben_norm - RuntimeWarning: invalid value encountered in _beta_ppf
FAILED scipy/stats/tests/test_fit.py::TestGoodnessOfFit::test_filliben_property - RuntimeWarning: invalid value encountered in _beta_ppf
FAILED scipy/stats/tests/test_fit.py::TestGoodnessOfFit::test_against_filliben_norm_table[case0] - RuntimeWarning: invalid value encountered in _beta_ppf
FAILED scipy/stats/tests/test_fit.py::TestGoodnessOfFit::test_against_filliben_norm_table[case1] - RuntimeWarning: invalid value encountered in _beta_ppf
FAILED scipy/stats/tests/test_fit.py::TestGoodnessOfFit::test_against_filliben_norm_table[case2] - RuntimeWarning: invalid value encountered in _beta_ppf

SciPy/NumPy/Python version and system information

1.13.0.dev0+0.9979b1d 1.26.4 sys.version_info(major=3, minor=11, micro=8, releaselevel='final', serial=0)
Build Dependencies:
  blas:
    detection method: pkgconfig
    found: true
    include directory: /Users/kai/miniconda3/envs/scipy-dev/include
    lib directory: /Users/kai/miniconda3/envs/scipy-dev/lib
    name: openblas
    openblas configuration: USE_64BITINT=0 DYNAMIC_ARCH=0 DYNAMIC_OLDER= NO_CBLAS=
      NO_LAPACK=0 NO_LAPACKE= NO_AFFINITY=1 USE_OPENMP=1 VORTEX MAX_THREADS=128
    pc file directory: /Users/kai/miniconda3/envs/scipy-dev/lib/pkgconfig
    version: 0.3.26
  lapack:
    detection method: pkgconfig
    found: true
    include directory: /Users/kai/miniconda3/envs/scipy-dev/include
    lib directory: /Users/kai/miniconda3/envs/scipy-dev/lib
    name: openblas
    openblas configuration: USE_64BITINT=0 DYNAMIC_ARCH=0 DYNAMIC_OLDER= NO_CBLAS=
      NO_LAPACK=0 NO_LAPACKE= NO_AFFINITY=1 USE_OPENMP=1 VORTEX MAX_THREADS=128
    pc file directory: /Users/kai/miniconda3/envs/scipy-dev/lib/pkgconfig
    version: 0.3.26
  pybind11:
    detection method: pkgconfig
    include directory: /Users/kai/miniconda3/envs/scipy-dev/include
    name: pybind11
    version: 2.11.1
Compilers:
  c:
    args: -ftree-vectorize, -fPIC, -fstack-protector-strong, -O2, -pipe, -isystem,
      /Users/kai/miniconda3/envs/scipy-dev/include, -D_FORTIFY_SOURCE=2, -isystem,
      /Users/kai/miniconda3/envs/scipy-dev/include
    commands: arm64-apple-darwin20.0.0-clang
    linker: ld64
    linker args: -Wl,-headerpad_max_install_names, -Wl,-dead_strip_dylibs, -Wl,-rpath,/Users/kai/miniconda3/envs/scipy-dev/lib,
      -L/Users/kai/miniconda3/envs/scipy-dev/lib, -ftree-vectorize, -fPIC, -fstack-protector-strong,
      -O2, -pipe, -isystem, /Users/kai/miniconda3/envs/scipy-dev/include, -D_FORTIFY_SOURCE=2,
      -isystem, /Users/kai/miniconda3/envs/scipy-dev/include
    name: clang
    version: 16.0.6
  c++:
    args: -ftree-vectorize, -fPIC, -fstack-protector-strong, -O2, -pipe, -stdlib=libc++,
      -fvisibility-inlines-hidden, -fmessage-length=0, -isystem, /Users/kai/miniconda3/envs/scipy-dev/include,
      -D_FORTIFY_SOURCE=2, -isystem, /Users/kai/miniconda3/envs/scipy-dev/include
    commands: arm64-apple-darwin20.0.0-clang++
    linker: ld64
    linker args: -Wl,-headerpad_max_install_names, -Wl,-dead_strip_dylibs, -Wl,-rpath,/Users/kai/miniconda3/envs/scipy-dev/lib,
      -L/Users/kai/miniconda3/envs/scipy-dev/lib, -ftree-vectorize, -fPIC, -fstack-protector-strong,
      -O2, -pipe, -stdlib=libc++, -fvisibility-inlines-hidden, -fmessage-length=0,
      -isystem, /Users/kai/miniconda3/envs/scipy-dev/include, -D_FORTIFY_SOURCE=2,
      -isystem, /Users/kai/miniconda3/envs/scipy-dev/include
    name: clang
    version: 16.0.6
  cython:
    commands: cython
    linker: cython
    name: cython
    version: 3.0.9
  fortran:
    args: -march=armv8.3-a, -ftree-vectorize, -fPIC, -fno-stack-protector, -O2, -pipe,
      -isystem, /Users/kai/miniconda3/envs/scipy-dev/include
    commands: /Users/kai/miniconda3/envs/scipy-dev/bin/arm64-apple-darwin20.0.0-gfortran
    linker: ld64
    linker args: -Wl,-headerpad_max_install_names, -Wl,-dead_strip_dylibs, -Wl,-rpath,/Users/kai/miniconda3/envs/scipy-dev/lib,
      -L/Users/kai/miniconda3/envs/scipy-dev/lib, -march=armv8.3-a, -ftree-vectorize,
      -fPIC, -fno-stack-protector, -O2, -pipe, -isystem, /Users/kai/miniconda3/envs/scipy-dev/include
    name: gcc
    version: 12.3.0
  pythran:
    include directory: ../../../miniconda3/envs/scipy-dev/lib/python3.11/site-packages/pythran
    version: 0.15.0
Machine Information:
  build:
    cpu: aarch64
    endian: little
    family: aarch64
    system: darwin
  cross-compiled: false
  host:
    cpu: aarch64
    endian: little
    family: aarch64
    system: darwin
Python Information:
  path: /Users/kai/miniconda3/envs/scipy-dev/bin/python3.11
  version: '3.11'

</details>
@Kai-Striega Kai-Striega added the defect A clear bug or issue that prevents SciPy from being installed or used as expected label Mar 7, 2024
@dschmitz89
Copy link
Contributor

Do you get the same errors using the incomplete beta function via special? That one also uses boost under the hood but was wrapped in a different way, might be worth trying out.

@Kai-Striega
Copy link
Member Author

No. Only in stats

@dschmitz89
Copy link
Contributor

We could try to replace the custom Boost wrappers for the beta distribution by directly calling the functions from special then. The required ones are

image

That would also reduce duplication between stats and special. special on its own has enough duplication already ;).

Would you be able to test it out? I do not have an M2 Mac to test locally.

@lucascolley
Copy link
Member

I reproduce these failures on my M1 Mac

@tylerjereddy
Copy link
Contributor

Those tests are passing on my M2 with Apple clang version 15.0.0 (clang-1500.3.9.4). Are you using the newer clang from above as well Lucas?

@lucascolley
Copy link
Member

Yes, I'm on clang 16.0.6 like Kai

@tylerjereddy
Copy link
Contributor

Ah yeah, and I bet you're both using conda too.

@Kai-Striega
Copy link
Member Author

Kai-Striega commented Mar 9, 2024

I'll test out using the ones for special tomorrow. Let's see if that makes a difference

EDIT: I didn't get the time to try out the special version. I'll try fit in some time this week, but I'm pretty time poor at the moment.

@rgommers
Copy link
Member

This is closely related to gh-14901 (long history) and also to gh-16583. And we should ensure to upgrade boost-math to the very latest commit first, to ensure we have the last N months worth of fixes included.

@rgommers
Copy link
Member

And I can confirm that I just started seeing this in a conda-forge env after recreating one from scratch. That gave me a newer build number of Clang 16.0.6; this code is very fragile, it probably has something to do with the defined boost-math "policies" for floating-point handling.

@czgdp1807
Copy link
Member

I will start looking into it in the afternoon today.

@czgdp1807
Copy link
Member

I think I am able to reproduce the issue,

=========================== short test summary info ============================
FAILED scipy/stats/tests/test_distributions.py::TestBeta::test_issue_12635 - RuntimeWarning: invalid value encountered in _beta_ppf
FAILED scipy/stats/tests/test_distributions.py::TestBeta::test_issue_12794 - RuntimeWarning: invalid value encountered in _beta_isf
FAILED scipy/stats/tests/test_distributions.py::TestBeta::test_issue_12796 - RuntimeWarning: invalid value encountered in _beta_ppf
FAILED scipy/stats/tests/test_distributions.py::TestBetaPrime::test_ppf[0.375-0.25-7.0-0.002036820346115211] - RuntimeWarning: invalid value encountered in _beta_ppf
FAILED scipy/stats/tests/test_fast_gen_inversion.py::test_rvs_and_ppf[betaprime-args6] - RuntimeWarning: invalid value encountered in _beta_ppf
FAILED scipy/stats/tests/test_fast_gen_inversion.py::test_non_rvs_methods_with_domain - RuntimeWarning: invalid value encountered in _beta_ppf
FAILED scipy/stats/tests/test_fit.py::TestGoodnessOfFit::test_against_filliben_norm - RuntimeWarning: invalid value encountered in _beta_ppf
FAILED scipy/stats/tests/test_fit.py::TestGoodnessOfFit::test_filliben_property - RuntimeWarning: invalid value encountered in _beta_ppf
FAILED scipy/stats/tests/test_fit.py::TestGoodnessOfFit::test_against_filliben_norm_table[case0] - RuntimeWarning: invalid value encountered in _beta_ppf
FAILED scipy/stats/tests/test_fit.py::TestGoodnessOfFit::test_against_filliben_norm_table[case1] - RuntimeWarning: invalid value encountered in _beta_ppf
FAILED scipy/stats/tests/test_fit.py::TestGoodnessOfFit::test_against_filliben_norm_table[case2] - RuntimeWarning: invalid value encountered in _beta_ppf
= 11 failed, 46989 passed, 2403 skipped, 14574 deselected, 150 xfailed, 13 xpassed in 280.89s (0:04:40) =
python dev.py test  320.14s user 50.77s system 129% cpu 4:46.20 total

I am on clang-16. I would like to point out that Clang-16 gives segmentation faults with PyTorch C++-API, however Clang-15 doesn't. I have experienced fragility/buggy nature of Clang-16 on my macOS before as well.

However first I will upgrade the scipy/_lib/boost_math and other methods before switching back to Clang-15.

@czgdp1807
Copy link
Member

czgdp1807 commented Mar 29, 2024

So as expected, the bug is due to clang-16. With clang-15, stats just work fine on my system,

Testing Logs
(scipy-dev-clang-15) 15:30:44:~/Quansight/scipy % python dev.py test -s stats
💻  ninja -C /Users/czgdp1807/Quansight/scipy/build -j10
ninja: Entering directory `/Users/czgdp1807/Quansight/scipy/build'
[4/4] Generating scipy/generate-version with a custom command
Build OK
💻  meson install -C build --only-changed
Installing, see meson-install.log...
Installation OK
SciPy from development installed path at: /Users/czgdp1807/Quansight/scipy/build-install/lib/python3.11/site-packages
Running tests for scipy version:1.14.0.dev0+666.9d6aac2, installed at:/Users/czgdp1807/Quansight/scipy/build-install/lib/python3.11/site-packages/scipy
============================= test session starts ==============================
platform darwin -- Python 3.11.8, pytest-8.1.1, pluggy-1.4.0
rootdir: /Users/czgdp1807/Quansight/scipy
configfile: pytest.ini
plugins: cov-5.0.0, timeout-2.2.0, anyio-4.3.0, hypothesis-6.99.13, xdist-3.5.0
collected 13111 items / 3804 deselected / 9307 selected                        

scipy/stats/tests/test_axis_nan_policy.py .............................. [  0%]
........................................................................ [  1%]
........................................................................ [  1%]
........................................................................ [  2%]
........................................................................ [  3%]
........................................................................ [  4%]
........................................................................ [  4%]
........................................................................ [  5%]
........................................................................ [  6%]
........................................................................ [  7%]
........................................................................ [  8%]
........................................................................ [  8%]
........................................................................ [  9%]
...............................sss...................................... [ 10%]
..................................................                       [ 10%]
scipy/stats/tests/test_binned_statistic.py ............................. [ 11%]
................................                                         [ 11%]
scipy/stats/tests/test_boost_ufuncs.py ............                      [ 11%]
scipy/stats/tests/test_censored_data.py ............                     [ 11%]
scipy/stats/tests/test_contingency.py .............                      [ 11%]
scipy/stats/tests/test_continuous_basic.py ...........................s. [ 12%]
......................ss..................................s...........s. [ 13%]
..............................s.......................ss................ [ 13%]
..................s...........s................................s........ [ 14%]
.............................................................s.......... [ 15%]
........................................................................ [ 16%]
........................................................................ [ 16%]
........................................................................ [ 17%]
........................................................................ [ 18%]
........................................................................ [ 19%]
........................................................................ [ 20%]
........................................................................ [ 20%]
........................................................................ [ 21%]
........................................................................ [ 22%]
........................................................................ [ 23%]
........................................................................ [ 23%]
........................................................................ [ 24%]
........................................................................ [ 25%]
.....s......................                                             [ 25%]
scipy/stats/tests/test_continuous_fit_censored.py ..................     [ 25%]
scipy/stats/tests/test_crosstab.py .............                         [ 26%]
scipy/stats/tests/test_discrete_basic.py ............................... [ 26%]
........................................................................ [ 27%]
........................................................................ [ 27%]
........................................................................ [ 28%]
........................................................................ [ 29%]
....................................................................     [ 30%]
scipy/stats/tests/test_discrete_distns.py .............................. [ 30%]
.........................................                                [ 30%]
scipy/stats/tests/test_distributions.py ................................ [ 31%]
......ssssssssssssssssssssssss.......................................... [ 32%]
........................................................................ [ 32%]
........................................................................ [ 33%]
........................................................................ [ 34%]
........................................................................ [ 35%]
........................................................................ [ 35%]
........................................................................ [ 36%]
........................................................................ [ 37%]
........................................................................ [ 38%]
........................................................................ [ 39%]
........................................................................ [ 39%]
........................................................................ [ 40%]
........................................................................ [ 41%]
........................................................................ [ 42%]
........................................................................ [ 42%]
........................................................................ [ 43%]
........................................................................ [ 44%]
........................................................................ [ 45%]
........................................................................ [ 46%]
........................................................................ [ 46%]
............................................................xxxx....s.s. [ 47%]
........................xxxxxxxxxx.....................s................ [ 48%]
.............................................s.......................... [ 49%]
..s..................................................................... [ 49%]
........................................................................ [ 50%]
........................................................................ [ 51%]
.......................................................s.....s.......... [ 52%]
........................................................................ [ 52%]
........................................................................ [ 53%]
................................................xxxxxxxxxxxxxxxxxxxxxxxx [ 54%]
xxx..................................................................... [ 55%]
..........................................s...................s......... [ 56%]
................ss.........................                              [ 56%]
scipy/stats/tests/test_entropy.py ....................................   [ 56%]
scipy/stats/tests/test_fast_gen_inversion.py ........................... [ 57%]
.............................................x.......................... [ 57%]
.......................................                                  [ 58%]
scipy/stats/tests/test_fit.py .......................................... [ 58%]
........................................................................ [ 59%]
.s....sss...s.s.ss.ssss.......ss.sssss.........sss....s..s..sss.s.ss...s [ 60%]
ss.ssss..........ss......s.s.ssss...sssssss.......sssss...s.s.sss.ssss.s [ 61%]
sss.ssssss.........s..................                                   [ 61%]
scipy/stats/tests/test_hypotests.py .................................... [ 61%]
........................................................................ [ 62%]
........................................................................ [ 63%]
...........................                                              [ 63%]
scipy/stats/tests/test_kdeoth.py ..........ss......ss....sssssssssssssss [ 64%]
s..ss......ss........s.s.....                                            [ 64%]
scipy/stats/tests/test_morestats.py .................................... [ 64%]
........................................................................ [ 65%]
........................................................................ [ 66%]
........................................................................ [ 67%]
........................................................................ [ 68%]
.............................................................            [ 68%]
scipy/stats/tests/test_mstats_basic.py ......s..s...............s....... [ 69%]
........................................................................ [ 69%]
.......................................                                  [ 70%]
scipy/stats/tests/test_mstats_extras.py ..........                       [ 70%]
scipy/stats/tests/test_multicomp.py .................................... [ 70%]
............                                                             [ 70%]
scipy/stats/tests/test_multivariate.py ......s.s..ss..ss............ssss [ 71%]
....ssss........ssssssss........ssssssss................................ [ 71%]
........................................................................ [ 72%]
........................................................................ [ 73%]
........................................................................ [ 74%]
.....................ssssssssssssssssssss............................... [ 75%]
........................................................................ [ 75%]
........................................................................ [ 76%]
............                                                             [ 76%]
scipy/stats/tests/test_odds_ratio.py ................................... [ 77%]
......................................................................   [ 77%]
scipy/stats/tests/test_qmc.py ........x................................. [ 78%]
........................sss..........................................s.s [ 79%]
.s.s.s.s.s...ssss............................                            [ 79%]
scipy/stats/tests/test_rank.py ......................................... [ 80%]
....                                                                     [ 80%]
scipy/stats/tests/test_relative_risk.py ...............                  [ 80%]
scipy/stats/tests/test_resampling.py ................................... [ 80%]
........................................................................ [ 81%]
........................................................................ [ 82%]
...............ss..........ssss.............                             [ 82%]
scipy/stats/tests/test_sampling.py ..................................... [ 83%]
........................................................................ [ 83%]
........................................................................ [ 84%]
.................s..ss...ssssssssss..s............................ssssss [ 85%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 86%]
sssssssssssssssssssssssssssssssssssss................................... [ 86%]
..................ssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 87%]
sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss........... [ 88%]
..................s..ss...ssssssssss..s................................  [ 89%]
scipy/stats/tests/test_sensitivity_analysis.py ........                  [ 89%]
scipy/stats/tests/test_stats.py ........................................ [ 89%]
.........sssssssss...................................................... [ 90%]
........................................................................ [ 91%]
........................................................................ [ 92%]
........................................................................ [ 92%]
...............................................ss....................... [ 93%]
..............................................................ss........ [ 94%]
............................................................xxx......... [ 95%]
........................................................................ [ 95%]
........................................................................ [ 96%]
........................................................................ [ 97%]
........................................................................ [ 98%]
.........................................................s.............. [ 99%]
....................................                                     [ 99%]
scipy/stats/tests/test_survival.py .......................               [ 99%]
scipy/stats/tests/test_tukeylambda_stats.py ...                          [ 99%]
scipy/stats/tests/test_variation.py ..............................       [100%]

== 8762 passed, 499 skipped, 3804 deselected, 46 xfailed in 97.67s (0:01:37) ===

Here is the environment file which I am using,

(scipy-dev-clang-15) 15:32:39:~/Quansight/scipy % git diff
diff --git a/environment.yml b/environment.yml
index 84c31d1c4..1a2dfd4f7 100644
--- a/environment.yml
+++ b/environment.yml
@@ -3,13 +3,13 @@
 #   $ conda env create -f environment.yml  # `mamba` works too for this command
 #   $ conda activate scipy-dev
 #
-name: scipy-dev
+name: scipy-dev-clang-15
 channels:
   - conda-forge
 dependencies:
   - python
   - cython>=3.0.8
-  - compilers  # Currently unavailable for Windows. Comment out this line and download Rtools and add <path>\ucrt64\bin\ to your path: https://cran.r-project.org/bin/windows/Rtools/rtools40.html
+  - compilers=1.6.0  # Currently unavailable for Windows. Comment out this line and download Rtools and add <path>\ucrt64\bin\ to your path: https://cran.r-project.org/bin/windows/Rtools/rtools40.html
   - meson
   - meson-python
   - ninja
diff --git a/scipy/_lib/boost_math b/scipy/_lib/boost_math
index 1a7be5d89..15c40fae1 160000
--- a/scipy/_lib/boost_math
+++ b/scipy/_lib/boost_math
@@ -1 +1 @@
-Subproject commit 1a7be5d895d266a870af7a6ed258e5bcf9838277
+Subproject commit 15c40fae1610fd83728d75e96d7377fe55f976f7

Though note that boost/math has been upgraded to 15c40fae1610fd83728d75e96d7377fe55f976f7 (the latest one - boostorg/math@15c40fa). Let me run the whole test suite as well just to make sure.

Update - = 47000 passed, 2403 skipped, 14574 deselected, 150 xfailed, 13 xpassed in 273.87s (0:04:33) =

The whole test suite passes with clang-15 and the above diff.

@czgdp1807
Copy link
Member

czgdp1807 commented Mar 29, 2024

So overall I'd say there are bugs in clang-16. In fact, while working on https://github.com/pytorch/pytorch/blob/main/docs/cpp/source/index.rst, I faced segmentation faults while compiling their sample sources with clang-16 (installed from conda-forge) both on CI and my local machine. However clang-15 is stable and has no such bugs.

From the above comment, it seems like same thing is happening with SciPy AFAICT. So may be for now we should fix compilers=1.6.0 in environment.yml file and also upgrade boost/math to the latest commit.

Update - As far as I can understand using scipy.special inside scipy.stats can be done and scipy.stats can pass on clang-16. Let's see if that can help with clang-16.

cc: @rgommers

@rgommers
Copy link
Member

So may be for now we should fix compilers=1.6.0 in environment.yml file

We can live with these failures for a little while, since they don't show up in CI. Let's try to resolve it first before pinning. It's not clearcut that it's only a Clang 16 bug; there are fixes in boost-math that we haven't pulled in yet, and there may be another bug (or multiple) hiding in boost-math.

and also upgrade boost/math to the latest commit.

Could you have a go at this?

@czgdp1807
Copy link
Member

czgdp1807 commented Mar 29, 2024

Could you have a go at this?

Yes I tried this first before switching to clang-15 but the tests still fail with clang-16 (combined with latest boost/math), however with clang-15 (combined with latest boost/math) they pass. See, the diff in #20208 (comment) (last two lines, boostorg/math@15c40fa latest commit).

We can live with these failures for a little while, since they don't show up in CI

Correct. I just looked above #20208 (comment) and #20208 (comment). Seems like, special doesn't have those bugs but stats do. I am looking into TestBeta::test_issue_12635. Let's see if the same input work with special but not with stats then I think #16583 would be the way forward.

@czgdp1807
Copy link
Member

czgdp1807 commented Mar 29, 2024

Seems like with the following diff (now available in this branch) alone the failures reduce to 1 only (scipy built on a clang-16 environment with latest _boost/math commit`)

diff --git a/scipy/stats/_continuous_distns.py b/scipy/stats/_continuous_distns.py
index 13af05009..ab9ec3ce3 100644
--- a/scipy/stats/_continuous_distns.py
+++ b/scipy/stats/_continuous_distns.py
@@ -692,12 +692,10 @@ class beta_gen(rv_continuous):
         return _boost._beta_sf(x, a, b)
 
     def _isf(self, x, a, b):
-        with np.errstate(over='ignore'):  # see gh-17432
-            return _boost._beta_isf(x, a, b)
+        return sc.betaincinv(a, b, 1 - x)
 
     def _ppf(self, q, a, b):
-        with np.errstate(over='ignore'):  # see gh-17432
-            return _boost._beta_ppf(q, a, b)
+        return sc.betaincinv(a, b, q)
 
     def _stats(self, a, b):
         return (
@@ -2289,7 +2287,7 @@ class f_gen(rv_continuous):
     the distribution of the ratio of two independent chi-squared distributions with
     :math:`df_1` and :math:`df_2` degrees of freedom, after rescaling by
     :math:`df_2 / df_1`.
-    
+
     The probability density function for `f` is:
 
     .. math::
FAILURES
=================================== FAILURES ===================================
_____________________ TestBeta.test_boost_eval_issue_14606 _____________________
scipy/stats/tests/test_distributions.py:4460: in test_boost_eval_issue_14606
    with pytest.warns(RuntimeWarning):
E   Failed: DID NOT WARN. No warnings of type (<class 'RuntimeWarning'>,) were emitted.
E    Emitted warnings: [].
        a          = 100000000000.0
        b          = 10000000000000.0
        q          = 0.995
        self       = <scipy.stats.tests.test_distributions.TestBeta object at 0x1606658d0>
=========================== short test summary info ============================
FAILED scipy/stats/tests/test_distributions.py::TestBeta::test_boost_eval_issue_14606 - Failed: DID NOT WARN. No warnings of type (<class 'RuntimeWarning'>,) were ...
= 1 failed, 8761 passed, 499 skipped, 3804 deselected, 46 xfailed in 95.51s (0:01:35) =

@czgdp1807
Copy link
Member

FAILED scipy/stats/tests/test_distributions.py::TestBeta::test_boost_eval_issue_14606 - Failed: DID NOT WARN. No warnings of type (<class 'RuntimeWarning'>,) were ...

This failure is because of the diff I made. Seems like, scipy.special.betaincinv doesn't raise warning, just gives NaN output.

@czgdp1807
Copy link
Member

czgdp1807 commented Mar 29, 2024

Seems like for this warning, scipy.special.betaincinv should also be giving the same RuntimeWarning? I think stats.beta.ppf and scipy.special.betaincinv are mathematically the same thing, correct? So for same inputs they should show similar behaviours as far as my understanding goes.

Other than this, I think we should be moving ahead with, #16583

cc: @rgommers

thalassemia added a commit to thalassemia/scipy that referenced this issue Apr 5, 2024
Avoids bug in Clang 16 (scipygh-20208)
[skip circle]
thalassemia added a commit to thalassemia/scipy that referenced this issue Apr 5, 2024
Avoids bug in Clang 16 (scipygh-20208)
[skip circle]
thalassemia added a commit to thalassemia/scipy that referenced this issue Apr 5, 2024
Avoids bug in Clang 16 (scipygh-20208)
[skip circle]
@lucascolley lucascolley added this to the 1.14.0 milestone Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.stats
Projects
None yet
6 participants