-
Notifications
You must be signed in to change notification settings - Fork 53
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
Fix issue17 #19
Fix issue17 #19
Conversation
def test_quantile_with_single_centroid_at_zero(self, empty_tdigest): | ||
td = empty_tdigest | ||
td.update(0) | ||
assert td.quantile(0) == 0.5 |
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.
should this be 0.5? The quantile is the value p
s.t. F(q) = p
. If F
is equal to 0 before 0, and 1 at and after 0, then I would expect this to be 1. (That's kind of confusing because of all the 0 and 1...)
I was thinking of a solution like this:
The CDF is a degenerate distribution, so the values should return 0 or 1, depending on if |
You're probably correct ; my thought process was more like "there's one centroid, they asked for the mean, so clearly they should get 0.5". Not only is your reasoning better, but also since |
The failure here is a bit inexplicable, not even in the code I changed, I think, and only in py3.3: 2.7 and 3.5 pass fine. Can you prod it to re-run the tests? |
Rerunning - apologies, I didn't see you update the code |
Potential fix for #17. Since there's only one value present, I assume a normal distribution with a standard deviation that gets lower the more samples there are of that value.