Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Kendall Rank Correlation Coefficient (Kendall's tau) #1271

Merged
merged 51 commits into from Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
260efcf
wip
stancld Oct 8, 2022
724e11a
WIP: Overhaul
stancld Oct 15, 2022
d564fa6
Do some polishing
stancld Oct 15, 2022
6018464
WIP: Add class metric + another refactor
stancld Oct 15, 2022
144e196
Merge branch 'master' into metric/kendall-tau
stancld Oct 15, 2022
22628b1
Add sorting for the other sequence to calcualte ties properly
stancld Oct 15, 2022
302577b
Add hypothesis testing + links to docs
stancld Oct 15, 2022
5976f5c
chlog
stancld Oct 15, 2022
f625f15
WIP: Add some tests
stancld Oct 15, 2022
fcfe90a
Fix dimension handling
stancld Oct 16, 2022
87fe723
Fix doctest
stancld Oct 16, 2022
12e2500
Add some docs + handle some mypy errors
stancld Oct 16, 2022
c773f8c
Update docs + fix some mypy errors
stancld Oct 16, 2022
9069411
Re-run mypy
stancld Oct 16, 2022
aa60932
Refactor: Separate calculate tau method
stancld Oct 16, 2022
ead166b
Refactor + Add variant c
stancld Oct 16, 2022
ec7ec6a
Fix a typo
stancld Oct 16, 2022
6c63a4a
Add testing for ddp=True and dist_sync_on_step=True options
stancld Oct 16, 2022
8053a48
Fix doctest
stancld Oct 16, 2022
98a8033
.
stancld Oct 16, 2022
3c74ebb
Fix tests for scipy<1.8.0
stancld Oct 16, 2022
f6a8d72
Fix some stuff in docs
stancld Oct 16, 2022
66f6f46
Add missing device placement
stancld Oct 16, 2022
b50f3fb
Fix some nits + add t-test examples to docs
stancld Oct 16, 2022
9eda894
Refactor: Move _check_data_shape_for_corr_coef to utils file
stancld Oct 16, 2022
c5553d5
Fix a typo
stancld Oct 16, 2022
2470205
Fix docs example for class metric
stancld Oct 16, 2022
bb81c43
Try to fix docs
stancld Oct 16, 2022
1103bbf
.
stancld Oct 16, 2022
87d2d94
Use different link to check if works
stancld Oct 16, 2022
9b845a5
sphinx: Ignore jstor link for linkcheck as cannot be accesed from python
stancld Oct 16, 2022
230c865
Merge branch 'master' into metric/kendall-tau
SkafteNicki Oct 24, 2022
64d427f
Apply suggestions from code review
Borda Oct 24, 2022
d6ea970
Merge branch 'master' into metric/kendall-tau
SkafteNicki Oct 25, 2022
b5b8176
Merge branch 'master' into metric/kendall-tau
SkafteNicki Oct 25, 2022
ec29996
Merge branch 'master' into metric/kendall-tau
SkafteNicki Oct 26, 2022
330bf4a
try something
SkafteNicki Oct 27, 2022
3ffe505
try again
SkafteNicki Oct 27, 2022
558dc10
remove mypy ignore
SkafteNicki Oct 31, 2022
3781189
Merge branch 'master' into metric/kendall-tau
SkafteNicki Oct 31, 2022
fefe505
remove comments
SkafteNicki Oct 31, 2022
1a710a2
fix some typing
SkafteNicki Oct 31, 2022
0056163
Merge branch 'master' into metric/kendall-tau
stancld Oct 31, 2022
04e420c
Fix mypy issues
stancld Oct 31, 2022
2fae0f9
Nudge mypy a bit
stancld Oct 31, 2022
92df4e1
Merge branch 'master' into metric/kendall-tau
stancld Oct 31, 2022
9ef2626
Merge branch 'master' into metric/kendall-tau
stancld Nov 1, 2022
600c5ca
Merge branch 'master' into metric/kendall-tau
SkafteNicki Nov 3, 2022
09859e3
Merge branch 'master' into metric/kendall-tau
stancld Nov 3, 2022
7a4d5a7
Merge branch 'master' into metric/kendall-tau
Borda Nov 3, 2022
ba51505
Merge branch 'master' into metric/kendall-tau
mergify[bot] Nov 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `TotalVariation` to image package ([#978](https://github.com/Lightning-AI/metrics/pull/978))


- Added `KendallRankCorrCoef` to regression package ([#1271](https://github.com/Lightning-AI/metrics/pull/1271))


### Changed

- Changed `MeanAveragePrecision` to vectorize `_find_best_gt_match` operation ([#1259](https://github.com/Lightning-AI/metrics/pull/1259))
Expand Down
2 changes: 2 additions & 0 deletions docs/source/links.rst
Expand Up @@ -93,3 +93,5 @@
.. _AB divergence: https://pdfs.semanticscholar.org/744b/1166de34cb099100f151f3b1459f141ae25b.pdf
.. _R茅nyi divergence: https://static.renyi.hu/renyi_cikkek/1961_on_measures_of_entropy_and_information.pdf
.. _Fisher-Rao distance: http://www.scholarpedia.org/article/Fisher-Rao_metric
.. _Kendall Rank Correlation Coefficient: https://en.wikipedia.org/wiki/Kendall_rank_correlation_coefficient
.. _The Treatment of Ties in Ranking Problems: https://www.jstor.org/stable/2332303
22 changes: 22 additions & 0 deletions docs/source/regression/kendall_rank_corr_coef.rst
@@ -0,0 +1,22 @@
.. customcarditem::
:header: Kendall Rank Correlation Coefficient
:image: https://pl-flash-data.s3.amazonaws.com/assets/thumbnails/tabular_classification.svg
:tags: Regression

.. include:: ../links.rst

#######################
Kendal Rank Corr. Coef.
#######################

Module Interface
________________

.. autoclass:: torchmetrics.KendallRankCorrCoef
:noindex:

Functional Interface
____________________

.. autofunction:: torchmetrics.functional.kendall_rank_corrcoef
:noindex:
2 changes: 2 additions & 0 deletions src/torchmetrics/__init__.py
Expand Up @@ -57,6 +57,7 @@
ConcordanceCorrCoef,
CosineSimilarity,
ExplainedVariance,
KendallRankCorrCoef,
KLDivergence,
MeanAbsoluteError,
MeanAbsolutePercentageError,
Expand Down Expand Up @@ -129,6 +130,7 @@
"HammingDistance",
"HingeLoss",
"JaccardIndex",
"KendallRankCorrCoef",
"KLDivergence",
"MatchErrorRate",
"MatthewsCorrCoef",
Expand Down
2 changes: 2 additions & 0 deletions src/torchmetrics/functional/__init__.py
Expand Up @@ -49,6 +49,7 @@
from torchmetrics.functional.regression.concordance import concordance_corrcoef
from torchmetrics.functional.regression.cosine_similarity import cosine_similarity
from torchmetrics.functional.regression.explained_variance import explained_variance
from torchmetrics.functional.regression.kendall import kendall_rank_corrcoef
from torchmetrics.functional.regression.kl_divergence import kl_divergence
from torchmetrics.functional.regression.log_mse import mean_squared_log_error
from torchmetrics.functional.regression.mae import mean_absolute_error
Expand Down Expand Up @@ -112,6 +113,7 @@
"hinge_loss",
"image_gradients",
"jaccard_index",
"kendall_rank_corrcoef",
"kl_divergence",
"match_error_rate",
"matthews_corrcoef",
Expand Down
1 change: 1 addition & 0 deletions src/torchmetrics/functional/regression/__init__.py
Expand Up @@ -14,6 +14,7 @@
from torchmetrics.functional.regression.concordance import concordance_corrcoef # noqa: F401
from torchmetrics.functional.regression.cosine_similarity import cosine_similarity # noqa: F401
from torchmetrics.functional.regression.explained_variance import explained_variance # noqa: F401
from torchmetrics.functional.regression.kendall import kendall_rank_corrcoef # noqa: F401
from torchmetrics.functional.regression.kl_divergence import kl_divergence # noqa: F401
from torchmetrics.functional.regression.log_mse import mean_squared_log_error # noqa: F401
from torchmetrics.functional.regression.mae import mean_absolute_error # noqa: F401
Expand Down