8000 BUG: 0 quantile for "inverted_cdf" methods gives highest value in array. · Issue #24593 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: 0 quantile for "inverted_cdf" methods gives highest value in array. #24593

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

Closed
matthew-brett opened this issue Aug 30, 2023 · 2 comments
Closed
Labels

Comments

@matthew-brett
Copy link
Contributor

Describe the issue:

See the code below. Asking for the 0 quantile, rather than some quantile very slightly greater than 0, returns the largest value in the array, when using method=:

  • 'averaged_inverted_cdf'
  • 'interpolated_inverted_cdf'

Reproduce the code example:

import numpy as np

data = np.arange(100)

for method in ('averaged_inverted_cdf', 'interpolated_inverted_cdf'):
    print('Using', method)
    print(np.quantile(data, 0, method=method))
    print(np.quantile(data, 1e-15, method=method))
    print(np.quantile(data, [0, 1e-15], method=method))

Error message:

The result is:


Using averaged_inverted_cdf
99
0.0
[0. 0.]
Using interpolated_inverted_cdf
99
0.0
[0. 0.]

where the first value for each method is clearly incorrect.



### Runtime information:

In [1] import sys, numpy; print(numpy.version); print(sys.version)
1.26.0b1
3.10.11 (main, Apr 7 2023, 07:24:53) [Clang 14.0.0 (clang-1400.0.29.202)]
In [2]: print(numpy.show_runtime())
WARNING: threadpoolctl not found in system! Install it by pip install threadpoolctl. Once installed, try np.show_runtime again for more detailed build information
[{'numpy_version': '1.26.0b1',
'python': '3.10.11 (main, Apr 7 2023, 07:24:53) [Clang 14.0.0 '
'(clang-1400.0.29.202)]',
'uname': uname_result(system='Darwin', node='nipraxis.dynevor.org', release='22.6.0', version='Darwin Kernel Version 22.6.0: Wed Jul 5 22:17:35 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T8112', machine='arm64')},
{'simd_extensions': {'baseline': ['NEON', 'NEON_FP16', 'NEON_VFPV4', 'ASIMD'],
'found': ['ASIMDHP'],
'not_found': ['ASIMDFHM']}}]


### Context for the issue:

_No response_
@eendebakpt
Copy link
Contributor

This is a duplicate of #24592

@seberg
Copy link
Member
seberg commented Feb 13, 2024

This was fixed, but not linked from the PR (which closed the duplicate)

@seberg seberg closed this as completed Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
0