-
Notifications
You must be signed in to change notification settings - Fork 422
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 pearson aggregation #998
Fix pearson aggregation #998
Conversation
The problem previously was that in the aggregation we were assuming that the per device
|
Codecov Report
@@ Coverage Diff @@
## master #998 +/- ##
=====================================
- Coverage 95% 95% -0%
=====================================
Files 179 179
Lines 7644 7652 +8
=====================================
- Hits 7255 7250 -5
- Misses 389 402 +13 |
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.
LGTM
Co-authored-by: Nicki Skafte Detlefsen <[email protected]>
for more information, see https://pre-commit.ci
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.
lgtm
* break tests * fix test * changelog * Apply suggestions from code review Co-authored-by: Nicki Skafte Detlefsen <[email protected]> (cherry picked from commit 32facee)
Can I pretty please get a tshirt for my contribution :) https://discord.com/channels/1077906959069626439/1077914894428549171/1210976775127957504 |
sure, pls fill the form :) |
where is the form sorry, I can't find it. |
Sorry about that! I just DM'd it to you on Discord. Thanks again! |
I am a bit confused by the current implementation of the A quick description of how to implement a parallel algorithm for aggregating running statistics for calculating Pearson correlation is given on the Wikipedia page for variance calculation algorithms (below the sections noted in the earlier comment by @ben-davidson-6). More detailed derivations and analysis can be found in papers by Chan et al. and Schubert et al. (which are cited by the Wikipedia article). While the current implementation can indeed be simplified into the equations provided by these references, it is significantly more complex (and difficult to understand). Is there any reason that I am overlooking (e.g., numerical precision, avoiding overflow) for this specific implementation? Below is a simplified implementation which I believe matches the output of the current (I have tested on my own data and it passes the torchmetrics unit tests), but is more closely aligned with the source algorithms. If there is no reason for the current implementation, would it be worthwhile to replace with this simpler implementation? An additional, IMPORTANT point: the current implementation modifies the states in place, such that if compute is called multiple times without cacheing, the value will drift. This would also be fixed in the below implementation.
|
What does this PR do?
Fixes aggregation across devices for PearsonCorrCoeff
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃