tensorflow / addons

Useful extra functionality for TensorFlow 2.x maintained by SIG-addons
Apache License 2.0
1.69k stars 610 forks source link

Add Kendall's Tau-c, Spearman's Rank, Pearson's Correlation metrics #2741

Closed nicolaspi closed 2 years ago

nicolaspi commented 2 years ago

Description

Add Kendall's Tau-c, Spearman's Rank, Pearson's Correlation metrics.

Type of change

Checklist:

How Has This Been Tested?

The tests follows the contribution guidelines for metrics (https://github.com/tensorflow/addons/blob/master/tensorflow_addons/metrics/README.md#contribution-guidelines). The metrics are tested against the scipy implementation counterpart.

bot-of-gabrieldemarmiesse commented 2 years ago

@sorensenjs

You are owner of some files modified in this pull request. Would you kindly review the changes whenever you have the time to? Thank you very much.

nicolaspi commented 2 years ago

There is no change per se, the original code remains the same modulo some refactoring. KendallsTau has been renamed KendallsTauB (to differenciate from KendallsTauC).

I have factored update_state from KendallsTau into a base class CorrelationBase with the abstract method result. For each metric, there is a concrete class that implements result with the corresponding metric's logic.

nicolaspi commented 2 years ago

@sorensenjs I changed the commit history to highlight the differences, this is the best I could come up with: https://github.com/tensorflow/addons/pull/2741/commits/b4977f41b44263406c84f28effb64428a2224200

bhack commented 2 years ago

@nicolaspi Can you PR the codeowners file to match this refactoring?