Skip to content

add cupy.quantile - #4370

Merged
mergify[bot] merged 2 commits into
cupy:masterfrom
grlee77:quantile
Dec 1, 2020
Merged

mergify[bot] merged 2 commits into
cupy:masterfrom
grlee77:quantile

Conversation

@grlee77

@grlee77 grlee77 commented Nov 30, 2020

Copy link
Copy Markdown
Member

This is a simple PR to add cupy.quantile which is the same as cupy.percentile but with q in the range [0, 1] rather than [0, 100].

This just reuses the existing cupy.percentile implementation, so there is not much new to review. The test cases are also copies of the tests for percentile, but using floating point q in the range [0, 1].

numpy.quantile was introduced in NumPy 1.15 which I think CuPy now requires, so I didn't do any with_requires checks in the tests.

One area to consider
I added range checks on q as in NumPy, but these require device synchronization, so it may not be desirable. If we don't want this, I can just remove use of _quantile_is_valid and the two *_out_of_range_q tests.

TST: check valid range of q for percentile as well

DOC: add quantile to API docs
=====================

.. https://docs.scipy.org/doc/scipy/reference/stats.html
.. https://numpy.org/doc/stable/reference/routines.statistics.html

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change to this line will be backported.

Comment thread cupy/_statistics/order.py Resolved
@toslunar toslunar self-assigned this Dec 1, 2020
@kmaehashi kmaehashi added cat:feature New features/APIs prio:medium labels Dec 1, 2020

@toslunar toslunar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@toslunar

toslunar commented Dec 1, 2020

Copy link
Copy Markdown
Member

pfnCI, test this please.

@toslunar toslunar added the st:test-and-merge (deprecated) Ready to merge after test pass. label Dec 1, 2020
@toslunar toslunar added this to the v9.0.0b1 milestone Dec 1, 2020
@chainer-ci

Copy link
Copy Markdown
Member

Jenkins CI test (for commit 64f8b68, target branch master) succeeded!

@mergify
mergify Bot merged commit 5d07601 into cupy:master Dec 1, 2020
@grlee77
grlee77 deleted the quantile branch December 18, 2020 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:feature New features/APIs prio:medium st:test-and-merge (deprecated) Ready to merge after test pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants