Repository navigation
[Data] Expand DistributionTracker: add merge() and p25/p75 - #64074
Conversation
Signed-off-by: Ayush Kumar <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request adds a merge method to DistributionTracker using Chan's parallel variant of Welford's algorithm and introduces new properties for the 25th (p25) and 75th (p75) percentiles. The feedback points out that these new percentile properties should be included in the as_dict() method of DistributionTracker to ensure they are properly serialized and reported in the metrics.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if self._sketch is None or other._sketch is None: | ||
| # Moments above still merged; quantile detail is lost for the | ||
| # side(s) without a sketch. | ||
| self._sketch = None |
There was a problem hiding this comment.
Maybe only None when both _sketch are None
There was a problem hiding this comment.
Keeping the partial sketch produces incorrect percentiles, as they would fall out of sync with the moments that we are merging. An alternative would be to not merge either moments or sketches if either sketch is none.
There was a problem hiding this comment.
I think it makes more sense to report the moments/mean always and report the quantiles as best effort (returning None) if available
Signed-off-by: Ayush Kumar <[email protected]>
Signed-off-by: Ayush Kumar <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
There are 3 total unresolved issues (including 1 from previous review).
Reviewed by Cursor Bugbot for commit 716629c. Configure here.
Signed-off-by: Ayush Kumar <[email protected]>
Signed-off-by: Ayush Kumar <[email protected]>
Signed-off-by: Ayush Kumar <[email protected]>
Signed-off-by: Ayush Kumar <[email protected]>
Signed-off-by: Ayush Kumar <[email protected]>
…ct#64074) ## Description In order to enable richer metric reporting and collection, we expand the implementation of DistributionTracker to have the following: - `merge(...)`: To combine two `DistributionTracker`'s into one - p25 - p75 `merge` helps us record statistics per-worker and then merge them for aggregate statistics, and the p25/p75 provide more information about the data distribution. ## Additional information Uses Chan's parallel variant of Welford's algorithm for moments. See: https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford:~:text=Parallel%20algorithm%5Bedit%5D --------- Signed-off-by: Ayush Kumar <[email protected]>
…ct#64074) ## Description In order to enable richer metric reporting and collection, we expand the implementation of DistributionTracker to have the following: - `merge(...)`: To combine two `DistributionTracker`'s into one - p25 - p75 `merge` helps us record statistics per-worker and then merge them for aggregate statistics, and the p25/p75 provide more information about the data distribution. ## Additional information Uses Chan's parallel variant of Welford's algorithm for moments. See: https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford:~:text=Parallel%20algorithm%5Bedit%5D --------- Signed-off-by: Ayush Kumar <[email protected]> Signed-off-by: 400Ping <[email protected]>

Description
In order to enable richer metric reporting and collection, we expand the implementation of DistributionTracker to have the following:
merge(...): To combine twoDistributionTracker's into onemergehelps us record statistics per-worker and then merge them for aggregate statistics, and the p25/p75 provide more information about the data distribution.Additional information
Uses Chan's parallel variant of Welford's algorithm for moments.
See: https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford:~:text=Parallel%20algorithm%5Bedit%5D