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

refactor(stdlib): rename percentile to quantile and implement percent… #1107

Merged
merged 1 commit into from
Mar 29, 2019

Conversation

jpacik
Copy link
Contributor

@jpacik jpacik commented Mar 28, 2019

…ile in terms of quantile

BREAKING CHANGE: Rename the percentile function to quantile. Also rename the percentile
parameter to q. Also implement a new percentile function that takes a parameter p that
is an integer between 0 and 100 inclusive. The new percentile function is defined in
terms of quantile.

Fixes #1072.

Done checklist

  • docs/SPEC.md updated
  • Test cases written

@jpacik jpacik self-assigned this Mar 28, 2019
@jpacik jpacik requested a review from nathanielc March 28, 2019 20:17
Copy link
Contributor

@nathanielc nathanielc left a comment

Choose a reason for hiding this comment

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

Looks good, with one small typo.

What are your thoughts? Does this change increase the readability and understandability of the code/stdlib?

It address the is the value between 0-100 or 0-1 well but does it create too many functions that are too similar?

docs/SPEC.md Outdated
@@ -1592,10 +1592,10 @@ Median is defined as:

median = (method="estimate_tdigest", compression=0.0, tables=<-) =>
tables
|> percentile(percentile:0.5, method:method, compression:compression)
|> quantile(quantile:0.5, method:method, compression:compression)
Copy link
Contributor

Choose a reason for hiding this comment

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

Below the argument is defined as q not quantile.

@jpacik
Copy link
Contributor Author

jpacik commented Mar 28, 2019

@nathanielc I think it's probably unnecessary, even though I put up the PR :) . They're exactly the same function, their arguments are just at different scales. I think I prefer to have just one way to perform a quantile calculation. I don't see it as a huge mental burden to switch between a [0, 1] scale vs [0, 100].

@nathanielc
Copy link
Contributor

nathanielc commented Mar 28, 2019

OK, in that case should we just rename it to quantile and not have a percentile function? There was some confusion around calling it a percentile while using a value between 0-1.

@jpacik
Copy link
Contributor Author

jpacik commented Mar 28, 2019

I would prefer it called quantile, especially if we are using values between 0 and 1. Currently it's a little inconsistent. But we don't need both functions.

BREAKING CHANGE: Rename the percentile function to quantile and rename the
percentile parameter to q.

Fixes #1072.
@jpacik jpacik force-pushed the refactor/rename-percentile branch from e3925f0 to 445a2cf Compare March 29, 2019 17:21
@jpacik jpacik merged commit bcfc535 into master Mar 29, 2019
@jpacik jpacik deleted the refactor/rename-percentile branch March 29, 2019 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants