Skip to content

Commit

Permalink
Newmetric: Negative predictive value (#2433)
Browse files Browse the repository at this point in the history
Co-authored-by: Luca Antiga <luca@lightning.ai>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
  • Loading branch information
4 people authored Oct 30, 2024
1 parent 70dabf1 commit 5d6bb56
Show file tree
Hide file tree
Showing 10 changed files with 1,624 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `NormalizedRootMeanSquaredError` metric to regression subpackage ([#2442](https://github.com/Lightning-AI/torchmetrics/pull/2442))


- Added `NegativePredictiveValue` to classification metrics ([#2433](https://github.com/Lightning-AI/torchmetrics/pull/2433))


- Added method `merge_state` to `Metric` ([#2786](https://github.com/Lightning-AI/torchmetrics/pull/2786))


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

.. include:: ../links.rst

#########################
Negative Predictive Value
#########################

Module Interface
________________

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

BinaryNegativePredictiveValue
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

MulticlassNegativePredictiveValue
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

MultilabelNegativePredictiveValue
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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


Functional Interface
____________________

.. autofunction:: torchmetrics.functional.negative_predictive_value

binary_negative_predictive_value
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.binary_negative_predictive_value

multiclass_negative_predictive_value
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.multiclass_negative_predictive_value

multilabel_negative_predictive_value
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.multilabel_negative_predictive_value
1 change: 1 addition & 0 deletions docs/source/links.rst
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,4 @@
.. _Hausdorff Distance: https://en.wikipedia.org/wiki/Hausdorff_distance
.. _averaging curve objects: https://scikit-learn.org/stable/auto_examples/model_selection/plot_roc.html
.. _Procrustes Disparity: https://en.wikipedia.org/wiki/Procrustes_analysis
.. _Negative Predictive Value: https://en.wikipedia.org/wiki/Positive_and_negative_predictive_values
2 changes: 2 additions & 0 deletions src/torchmetrics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
HingeLoss,
JaccardIndex,
MatthewsCorrCoef,
NegativePredictiveValue,
Precision,
PrecisionAtFixedRecall,
PrecisionRecallCurve,
Expand Down Expand Up @@ -207,6 +208,7 @@
"MultiScaleStructuralSimilarityIndexMeasure",
"MultioutputWrapper",
"MultitaskWrapper",
"NegativePredictiveValue",
"NormalizedRootMeanSquaredError",
"PanopticQuality",
"PeakSignalNoiseRatio",
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 @@ -63,6 +63,12 @@
MulticlassMatthewsCorrCoef,
MultilabelMatthewsCorrCoef,
)
from torchmetrics.classification.negative_predictive_value import (
BinaryNegativePredictiveValue,
MulticlassNegativePredictiveValue,
MultilabelNegativePredictiveValue,
NegativePredictiveValue,
)
from torchmetrics.classification.precision_fixed_recall import (
BinaryPrecisionAtFixedRecall,
MulticlassPrecisionAtFixedRecall,
Expand Down Expand Up @@ -217,4 +223,8 @@
"MulticlassSensitivityAtSpecificity",
"MultilabelSensitivityAtSpecificity",
"SensitivityAtSpecificity",
"BinaryNegativePredictiveValue",
"MulticlassNegativePredictiveValue",
"MultilabelNegativePredictiveValue",
"NegativePredictiveValue",
]
Loading

0 comments on commit 5d6bb56

Please sign in to comment.