Skip to content

Commit

Permalink
Add SpecificityAtSensitivity Metric (#1432)
Browse files Browse the repository at this point in the history
Co-authored-by: Justus Schock <[email protected]>
  • Loading branch information
shenoynikhil and justusschock authored Jan 27, 2023
1 parent 9dc9354 commit 3f93c72
Show file tree
Hide file tree
Showing 8 changed files with 1,300 additions and 33 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added support for `SpecificityAtSensitivity` Metric ([#1432](https://github.com/Lightning-AI/metrics/pull/1432))

- Added support for plotting of metrics through `.plot()` method ([#1328](https://github.com/Lightning-AI/metrics/pull/1328))


Expand Down
53 changes: 53 additions & 0 deletions docs/source/classification/specificity_at_sensitivity.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.. customcarditem::
:header: Specificity At Sensitivity
:image: https://pl-flash-data.s3.amazonaws.com/assets/thumbnails/tabular_classification.svg
:tags: Classification

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

Module Interface
________________

BinarySpecificityAtSensitivity
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

MulticlassSpecificityAtSensitivity
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

MultilabelSpecificityAtSensitivity
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

Functional Interface
____________________

binary_specificity_at_sensitivity
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.binary_specificity_at_sensitivity
:noindex:

multiclass_specificity_at_sensitivity
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.multiclass_specificity_at_sensitivity
:noindex:

multilabel_specificity_at_sensitivity
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.multilabel_specificity_at_sensitivity
:noindex:
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ select = [
#]
ignore = [
"E731", # Do not assign a lambda expression, use a def
"F401", # Imports of __all__
]
# Exclude a variety of commonly ignored directories.
exclude = [
Expand All @@ -98,6 +99,7 @@ exclude = [
"docs"
]
ignore-init-module-imports = true
unfixable = ["F401"]

[tool.ruff.per-file-ignores]
"setup.py" = ["D100", "SIM115"]
Expand Down
8 changes: 8 additions & 0 deletions src/torchmetrics/classification/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@
MultilabelSpecificity,
Specificity,
)
from torchmetrics.classification.specificity_at_sensitivity import (
BinarySpecificityAtSensitivity,
MulticlassSpecificityAtSensitivity,
MultilabelSpecificityAtSensitivity,
)

__all__ = [
"BinaryConfusionMatrix",
Expand Down Expand Up @@ -188,4 +193,7 @@
"MulticlassSpecificity",
"MultilabelSpecificity",
"Specificity",
"BinarySpecificityAtSensitivity",
"MulticlassSpecificityAtSensitivity",
"MultilabelSpecificityAtSensitivity",
]
Loading

0 comments on commit 3f93c72

Please sign in to comment.