Update docs for quantile to be clearer for nearest#162423
Update docs for quantile to be clearer for nearest#162423
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/162423
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 2 PendingAs of commit ff697a8 with merge base fecd968 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
| - ``lower``: ``a``. | ||
| - ``higher``: ``b``. | ||
| - ``nearest``: ``a`` or ``b``, whichever's index is closer to the computed quantile index (rounding down for .5 fractions). | ||
| - ``nearest``: ``a`` or ``b``, whichever's index is closer to the computed quantile index |
There was a problem hiding this comment.
So the current docs are wrong? If we follow the "round to even" rules like torch.round, it would mean that 1.5 is rounded up and 2.5 is rounded down, and not always rounded down like the current docs suggest.
There was a problem hiding this comment.
Oh you mention that in your description, but title suggests it just makes things clearer
There was a problem hiding this comment.
Yes, there's a discrepancy.
x = torch.tensor([0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0])
quantiles = torch.tensor([0.25])
result = torch.quantile(x, quantiles, interpolation="nearest")
print(result)
Rounds 1.5 up to 2 instead of 1
There was a problem hiding this comment.
Yes! This was prompted from a pytorch q&a post
e1ca808 to
494d787
Compare
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Correct the rounding scheme for nearest in quantile. Pull Request resolved: pytorch#162423 Approved by: https://github.com/soulitzer
Correct the rounding scheme for nearest in quantile. Pull Request resolved: pytorch#162423 Approved by: https://github.com/soulitzer
Correct the rounding scheme for nearest in quantile. Pull Request resolved: pytorch#162423 Approved by: https://github.com/soulitzer
Correct the rounding scheme for nearest in quantile. Pull Request resolved: pytorch#162423 Approved by: https://github.com/soulitzer
Correct the rounding scheme for nearest in quantile.