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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New metric: Precision at fixed recall #1683

Merged
merged 26 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
78d148c
add doc page
SkafteNicki Apr 3, 2023
6a2d9d7
add init files
SkafteNicki Apr 3, 2023
0d7fd20
copy-pasta
SkafteNicki Apr 3, 2023
a223a6a
change recall to precision
SkafteNicki Apr 3, 2023
7858ed6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 3, 2023
2fe0e46
changelog
SkafteNicki Apr 3, 2023
9ac7754
Merge branch 'metric/precision_at_fixed_recall' of https://github.com…
SkafteNicki Apr 3, 2023
dfe68a1
rename
Borda Apr 3, 2023
2af6a52
rename
Borda Apr 3, 2023
a314bc0
Merge branch 'master' into metric/precision_at_fixed_recall
Borda Apr 3, 2023
2a83413
fixing
Borda Apr 4, 2023
3996964
...
Borda Apr 4, 2023
cadee18
Merge branch 'master' into metric/precision_at_fixed_recall
Borda Apr 4, 2023
c96a3b3
Merge branch 'master' into metric/precision_at_fixed_recall
Borda Apr 5, 2023
74be3b2
Merge branch 'master' into metric/precision_at_fixed_recall
SkafteNicki Apr 11, 2023
1c8b9c5
Merge branch 'master' into metric/precision_at_fixed_recall
SkafteNicki Apr 11, 2023
6eb2854
Merge branch 'master' into metric/precision_at_fixed_recall
stancld Apr 11, 2023
7afffe1
Merge branch 'master' into metric/precision_at_fixed_recall
SkafteNicki Apr 13, 2023
1aa3169
Merge branch 'master' into metric/precision_at_fixed_recall
Borda Apr 13, 2023
01c2f57
fixing
Borda Apr 13, 2023
7bba621
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 13, 2023
a11be3f
Merge branch 'master' into metric/precision_at_fixed_recall
mergify[bot] Apr 13, 2023
714b958
try fixing typing
SkafteNicki Apr 14, 2023
7b17fe6
Merge branch 'master' into metric/precision_at_fixed_recall
Borda Apr 14, 2023
53b2d6b
fix mypy
SkafteNicki Apr 14, 2023
8e9493d
fix scripting issue
SkafteNicki Apr 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `ModifiedPanopticQuality` metric to detection package ([#1627](https://github.com/Lightning-AI/metrics/pull/1627))


- Added `PrecisionAtFixedRecall` metric to classification package ([#1683](https://github.com/Lightning-AI/torchmetrics/pull/1683))


### Changed

- Changed `update_count` and `update_called` from private to public methods ([#1370](https://github.com/Lightning-AI/metrics/pull/1370))
Expand Down
53 changes: 53 additions & 0 deletions docs/source/classification/precision_at_fixed_recall.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.. customcarditem::
:header: Recall At Fixed Precision
:image: https://pl-flash-data.s3.amazonaws.com/assets/thumbnails/tabular_classification.svg
:tags: Classification

#########################
Precision At Fixed Recall
#########################

Module Interface
________________

BinaryPrecisionAtFixedRecall
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.BinaryPrecisionAtFixedRecall
:noindex:
:exclude-members: update, compute

MulticlassPrecisionAtFixedRecall
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.MulticlassPrecisionAtFixedRecall
:noindex:
:exclude-members: update, compute

MultilabelPrecisionAtFixedRecall
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.MultilabelPrecisionAtFixedRecall
:noindex:
:exclude-members: update, compute

Functional Interface
____________________

binary_precision_at_fixed_recall
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.binary_precision_at_fixed_recall
:noindex:

multiclass_precision_at_fixed_recall
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.multiclass_precision_at_fixed_recall
:noindex:

multilabel_precision_at_fixed_recall
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.multilabel_precision_at_fixed_recall
:noindex:
4 changes: 4 additions & 0 deletions src/torchmetrics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@
JaccardIndex,
MatthewsCorrCoef,
Precision,
PrecisionAtFixedRecall,
PrecisionRecallCurve,
Recall,
RecallAtFixedPrecision,
Specificity,
StatScores,
)
Expand Down Expand Up @@ -173,10 +175,12 @@
"PermutationInvariantTraining",
"Perplexity",
"Precision",
"PrecisionAtFixedRecall",
"PrecisionRecallCurve",
"PeakSignalNoiseRatio",
"R2Score",
"Recall",
"RecallAtFixedPrecision",
"RelativeAverageSpectralError",
"RetrievalFallOut",
"RetrievalHitRate",
Expand Down
19 changes: 17 additions & 2 deletions src/torchmetrics/classification/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@
MulticlassMatthewsCorrCoef,
MultilabelMatthewsCorrCoef,
)
from torchmetrics.classification.precision_fixed_recall import (
BinaryPrecisionAtFixedRecall,
MulticlassPrecisionAtFixedRecall,
MultilabelPrecisionAtFixedRecall,
PrecisionAtFixedRecall,
)
from torchmetrics.classification.precision_recall import (
BinaryPrecision,
BinaryRecall,
Expand All @@ -84,10 +90,11 @@
MultilabelRankingAveragePrecision,
MultilabelRankingLoss,
)
from torchmetrics.classification.recall_at_fixed_precision import (
from torchmetrics.classification.recall_fixed_precision import (
BinaryRecallAtFixedPrecision,
MulticlassRecallAtFixedPrecision,
MultilabelRecallAtFixedPrecision,
RecallAtFixedPrecision,
)
from torchmetrics.classification.roc import ROC, BinaryROC, MulticlassROC, MultilabelROC
from torchmetrics.classification.specificity import (
Expand All @@ -96,7 +103,7 @@
MultilabelSpecificity,
Specificity,
)
from torchmetrics.classification.specificity_at_sensitivity import (
from torchmetrics.classification.specificity_sensitivity import (
BinarySpecificityAtSensitivity,
MulticlassSpecificityAtSensitivity,
MultilabelSpecificityAtSensitivity,
Expand Down Expand Up @@ -193,4 +200,12 @@
"BinarySpecificityAtSensitivity",
"MulticlassSpecificityAtSensitivity",
"MultilabelSpecificityAtSensitivity",
"BinaryPrecisionAtFixedRecall",
"MulticlassPrecisionAtFixedRecall",
"MultilabelPrecisionAtFixedRecall",
"PrecisionAtFixedRecall",
"RecallAtFixedPrecision",
"BinaryPrecisionAtFixedRecall",
"MulticlassPrecisionAtFixedRecall",
"MultilabelPrecisionAtFixedRecall",
]
Loading