Skip to content

Commit

Permalink
Add SensitivityAtSpecificity metric (#2217)
Browse files Browse the repository at this point in the history
Co-authored-by: Jirka Borovec <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Nicki Skafte Detlefsen <[email protected]>
  • Loading branch information
4 people authored Feb 14, 2024
1 parent 59d0a11 commit 442c463
Show file tree
Hide file tree
Showing 10 changed files with 1,403 additions and 30 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

-
- Added `SensitivityAtSpecificity` metric to classification subpackage ([#2217](https://github.com/Lightning-AI/torchmetrics/pull/2217))


- Added `QualityWithNoReference` metric ([#2288](https://github.com/Lightning-AI/torchmetrics/pull/2288))
Expand Down Expand Up @@ -67,6 +67,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `aggregate` argument to retrieval metrics ([#2220](https://github.com/Lightning-AI/torchmetrics/pull/2220))
- Added utility functions in `segmentation.utils` for future segmentation metrics ([#2105](https://github.com/Lightning-AI/torchmetrics/pull/2105))


### Changed

- Changed minimum supported Pytorch version from 1.8 to 1.10 ([#2145](https://github.com/Lightning-AI/torchmetrics/pull/2145))
Expand Down
55 changes: 55 additions & 0 deletions docs/source/classification/sensitivity_at_specificity.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
.. customcarditem::
:header: Sensitivity At Specificity
:image: https://pl-flash-data.s3.amazonaws.com/assets/thumbnails/tabular_classification.svg
:tags: Classification

.. include:: ../links.rst

##########################
Sensitivity At Specificity
##########################

Module Interface
________________

.. autoclass:: torchmetrics.SensitivityAtSpecificity
:exclude-members: update, compute
:special-members: __new__

BinarySensitivityAtSpecificity
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.BinarySensitivityAtSpecificity
:exclude-members: update, compute

MulticlassSensitivityAtSpecificity
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.MulticlassSensitivityAtSpecificity
:exclude-members: update, compute

MultilabelSensitivityAtSpecificity
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.MultilabelSensitivityAtSpecificity
:exclude-members: update, compute

Functional Interface
____________________

.. autofunction:: torchmetrics.functional.classification.sensitivity_at_specificity

binary_sensitivity_at_specificity
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.binary_sensitivity_at_specificity

multiclass_sensitivity_at_specificity
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.multiclass_sensitivity_at_specificity

multilabel_sensitivity_at_specificity
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.multilabel_sensitivity_at_specificity
2 changes: 2 additions & 0 deletions src/torchmetrics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
PrecisionRecallCurve,
Recall,
RecallAtFixedPrecision,
SensitivityAtSpecificity,
Specificity,
SpecificityAtSensitivity,
StatScores,
Expand Down Expand Up @@ -235,6 +236,7 @@
"SpearmanCorrCoef",
"Specificity",
"SpecificityAtSensitivity",
"SensitivityAtSpecificity",
"SpectralAngleMapper",
"SpectralDistortionIndex",
"SQuAD",
Expand Down
10 changes: 10 additions & 0 deletions src/torchmetrics/classification/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@
RecallAtFixedPrecision,
)
from torchmetrics.classification.roc import ROC, BinaryROC, MulticlassROC, MultilabelROC
from torchmetrics.classification.sensitivity_specificity import (
BinarySensitivityAtSpecificity,
MulticlassSensitivityAtSpecificity,
MultilabelSensitivityAtSpecificity,
SensitivityAtSpecificity,
)
from torchmetrics.classification.specificity import (
BinarySpecificity,
MulticlassSpecificity,
Expand Down Expand Up @@ -207,4 +213,8 @@
"BinaryPrecisionAtFixedRecall",
"MulticlassPrecisionAtFixedRecall",
"MultilabelPrecisionAtFixedRecall",
"BinarySensitivityAtSpecificity",
"MulticlassSensitivityAtSpecificity",
"MultilabelSensitivityAtSpecificity",
"SensitivityAtSpecificity",
]
Loading

0 comments on commit 442c463

Please sign in to comment.