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

Consider selection algorithm for quartiles #4

Open
jpmckinney opened this issue Feb 9, 2023 · 5 comments
Open

Consider selection algorithm for quartiles #4

jpmckinney opened this issue Feb 9, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@jpmckinney
Copy link

Selection algorithm is O(n) https://en.wikipedia.org/wiki/Selection_algorithm

It's what statrs uses.

https://github.com/statrs-dev/statrs/blob/5411ba74b427b992dd1410d699052a0b41dc2b5c/src/statistics/slice_statistics.rs#L37-L102

@jqnatividad
Copy link
Owner

Thanks @jpmckinney ... will dig into this...

BTW, while I have your attention, I've been looking for an algorithm to calculate kurtosis on a streaming basis... would you know of one?

@jpmckinney
Copy link
Author

Hmm, I'm not familiar with kurtosis, but from a quick glance at its calculation, I'm not sure you can stream it – unless you use an approximation. (Of course, there may be a very ingenious solution!)

@jqnatividad jqnatividad added the enhancement New feature or request label May 6, 2023
@jqnatividad jqnatividad self-assigned this May 6, 2023
@jqnatividad
Copy link
Owner

On using a selection algorithm, is there a particular reason the current algorithm needs to be replaced?

@jpmckinney
Copy link
Author

Selection algorithm is faster – O(n).

rust-stats currently sorts first, which is O(n log n).

@jqnatividad
Copy link
Owner

Got it. Will look into using selection algorithm... in the meantime, qsv-stats now uses rayon for parallel sorting, so it should be markedly faster.

6c63f60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants