Skip to content

ENH: Quantile - #10199

Merged
shoyer merged 1 commit into
numpy:masterfrom
chunweiyuan:quantile
Apr 24, 2018
Merged

shoyer merged 1 commit into
numpy:masterfrom
chunweiyuan:quantile

Conversation

@chunweiyuan

Copy link
Copy Markdown

This is forked off eric-wieser:quantile for #9213, with some rebasing help. A second attempt at this, after the botched #10180.

@eric-wieser

eric-wieser commented Dec 11, 2017 •

Copy link
Copy Markdown
Member

Looks like you rebased all the commits, when you should have only rebased the last ones. I don't remember the command line, because I cheat and use a graphical tool, but there's a way to tell git rebase which commit to start from. At the very least, you can git rebase -i on my branch, and choose only your last two commits

@chunweiyuan

Copy link
Copy Markdown
Author

Must admit I'm a total noob when it comes to rebasing......

@eric-wieser

Copy link
Copy Markdown
Member

You've managed to pick up some extra commits here somehow, but it's looking closer than it was

@chunweiyuan

Copy link
Copy Markdown
Author

mind telling me which ones I need to nix now? I think I'm just gonna start from where it is now and rebase -i until it's all pruned.

@eric-wieser

Copy link
Copy Markdown
Member

The first two by charris, which are already on master. I think you just need to git fetch --all first

@chunweiyuan

Copy link
Copy Markdown
Author

@eric-wieser , is this PR close to approval?

Comment thread numpy/lib/function_base.py Outdated

@eric-wieser eric-wieser Dec 18, 2017 •

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.

I'd prefer it if these errors were separate as before. Should be easy with one more layer of helper function, with the (reversed) call graph looking like

  • _quantile (rename to _quantile_ureduce_func?)
    • _quantile_unchecked - expects a true ndarray in [0, 1]
      • quantile
      • percentile

@eric-wieser

Copy link
Copy Markdown
Member

This patch is big, and mostly touches docstrings. Can I suggest we break this into two PRs?

  • A MAINT: use the _valid_quantile , _quantile_unchecked, and _quantile_ureduce_func functions as helper functions to implement the existing percentile and nanpercentile. This doesn't need to touch any docs, and is just a maintenance change

  • An ENH: add quantile and nanquantile, along with docstrings

@eric-wieser

Copy link
Copy Markdown
Member

I'll see if I can break out the first half, and leave the second to you

@eric-wieser

Copy link
Copy Markdown
Member

Alright, done in #10241

@eric-wieser

Copy link
Copy Markdown
Member

Ball is back in your court. I wouldn't bother trying to preserve history at this point - just add everything in one commit - you might want to start by just choosing your version when merging, then removing bits of the diff that don't matter.

Comment thread numpy/lib/function_base.py Outdated

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.

Think you might need an asarray here for quantile

@chunweiyuan

Copy link
Copy Markdown
Author

Added more test coverage. I think I also figured out how to resolve the CircleCI issue I've been having.

@chunweiyuan

Copy link
Copy Markdown
Author

This PR is begging for some more critiques, or perhaps approval?

@shoyer

shoyer commented Apr 16, 2018

Copy link
Copy Markdown
Member

This looks good to me. Anyone else?

Comment thread doc/release/1.15.0-notes.rst Outdated

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.

nit: missing newline due to the merge / rebase

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed.

@eric-wieser

Copy link
Copy Markdown
Member

I'm also in favor as it currently is, but I had too much of a hand in this to feel comfortable merging it myself.

@eric-wieser

eric-wieser commented Apr 17, 2018 •

Copy link
Copy Markdown
Member

@stefanv: I'd argue that's out of scope for this PR, and something that we should address separately.

Having said that, it worries me that large amounts of the documentation is duplicated. I originally proposed this with almost all of the docs moving to quantile, and a brief summary and a link in percentile. IIRC this was unpopular, meaning we're now left with divergent docstrings...

@stefanv

stefanv commented Apr 17, 2018

Copy link
Copy Markdown
Contributor

Is percentile being deprecated? If so, at least this won't matter for very long.

@eric-wieser

eric-wieser commented Apr 17, 2018 •

Copy link
Copy Markdown
Member

I doubt we can get away with a DeprecationWarning in percentile. At best I can see us recommending quantile as a simpler interface in the docs of percentile.

@chunweiyuan

chunweiyuan commented Apr 17, 2018 •

Copy link
Copy Markdown
Author

I think there are lots of people out there that are ideologically attached to percentile over quantile that in the short term we'll have to maintain both. This PR (thank you @eric-wieser) has removed a lot of the redundancy already. Down the road it'd be nice to start trimming away slowly, starting with the redundant docs.

But first things first, let's please merge this PR.

@chunweiyuan

Copy link
Copy Markdown
Author

I might have a little bit of time to work on my numpy PRs this week. Is there anything more that needs to be done here? If not, could someone merge it in?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants