-
Notifications
You must be signed in to change notification settings - Fork 28
Bulk quantiles #26
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
Bulk quantiles #26
Conversation
I started reviewing this PR. This is great work. I created LukeMathWalker#1 with a few changes. I had a couple of thoughts:
Edit: It would be good to rebase this branch off the latest master to resolve merge conflicts and incorporate #28. |
I have merged your PR - all useful additions/style changes! I can't confirm the average complexity you estimated for your alternative implementation, but it intuitively looks faster and Re:IndexMap - I think it's a matter of preference, I usually find it error-prone to match input/output indexes, the way NumPy forces you to work sometimes, an IndexMap looks more ergonomic to me . The solid pro I can see in returning an |
…e for bulk computation
This has a few advantages: * It's now possible to save the interpolation strategy in a variable and easily re-use it. * We can now freely add more type parameters to the `quantile*` methods as needed without making them more difficult to call. * We now have the flexibility to add more advanced interpolation strategies in the future (e.g. one that wraps a closure). * Calling the `quantile*` methods is now slightly more compact because a turbofish isn't necessary.
This is slightly more versatile because `ArrayBase` allows arbitrary strides.
I finished reviewing this PR and added some more changes to LukeMathWalker#5. The primary additional changes are:
With change (1), we can now change What do you think? |
Improve bulk quantiles
I think it makes sense to take I'd keep |
I have merged master and aligned return types ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a few comments. Everything else looks good.
Co-Authored-By: LukeMathWalker <[email protected]>
I have used |
Yay! 🎉 Great job on these PRs @LukeMathWalker! |
Thanks for your help @jturner314 - you always manage to make them much better 🙏 |
Using the ordering guarantees we have on the output of
quantile_mut
/sorted_get_mut
, it provides a method optimized to compute multiple quantiles at once (by scanning an increasingly smaller subset of the original array, thanks to the computation of the previous quantile).Breaking changes:
f64
toN64
- floats are not hashable, hence they cannot be used as keys inIndexMap
and the function panics anyway if that argument isNaN
. This change propagates to theInterpolate
types;sorted_get_mut
toget_from_sorted
. It plays better with the bulk version,get_many_from_sorted
, and I think it's clearer;quantile_axis_mut
andquantile_axis_skipnan_mut
now return anOption
instead of panicking if the axis length is 0.