Skip to content
Snippets Groups Projects
Commit 87a6e0c6 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[utils.measure] Fix docstring

parent 3ebea75e
No related branches found
No related tags found
No related merge requests found
Pipeline #39705 passed
...@@ -29,55 +29,51 @@ class SmoothedValue: ...@@ -29,55 +29,51 @@ class SmoothedValue:
def base_measures(tp, fp, tn, fn): def base_measures(tp, fp, tn, fn):
""" """Calculates measures from true/false positive and negative counts
Calculates a bunch of measures from true/false positive and negative counts
This function can return standard machine learning measures from true and This function can return standard machine learning measures from true and
false positive counts of positives and negatives. For a thorough look into false positive counts of positives and negatives. For a thorough look into
these and alternate names for the returned values, please check Wikipedia's these and alternate names for the returned values, please check Wikipedia's
entry on `Precision and Recall`_. entry on `Precision and Recall
<https://en.wikipedia.org/wiki/Precision_and_recall>`_.
Parameters Parameters
---------- ----------
tp : int tp : int
True positive count, AKA "hit" True positive count, AKA "hit"
fp : int fp : int
False positive count, AKA, "correct rejection" False positive count, AKA, "correct rejection"
tn : int tn : int
True negative count, AKA "false alarm", or "Type I error" True negative count, AKA "false alarm", or "Type I error"
fn : int fn : int
False Negative count, AKA "miss", or "Type II error" False Negative count, AKA "miss", or "Type II error"
Returns Returns
------- -------
precision : float precision : float
P, AKA positive predictive value (PPV) P, AKA positive predictive value (PPV).
:math:`\frac{tp}{tp+fp}`
recall : float recall : float
R, AKA sensitivity, hit rate, or true positive rate (TPR) R, AKA sensitivity, hit rate, or true positive rate (TPR).
:math:`\frac{tp}{p} = \frac{tp}{tp+fn}`
specificity : float specificity : float
S, AKA selectivity or true negative rate (TNR). S, AKA selectivity or true negative rate (TNR).
:math:`\frac{tn}{n} = \frac{tn}{tn+fp}`
accuracy : float accuracy : float
A, :math:`\frac{tp + tn}{p + n} = \frac{tp + tn}{tp + fp + tn + fn}` A
jaccard : float jaccard : float
J, :math:`\frac{tp}{tp+fp+fn}`, see `Jaccard Index`_ J, see `Jaccard Index <https://en.wikipedia.org/wiki/Jaccard_index>`_
f1_score : float f1_score : float
F1, :math:`\frac{2 P R}{P + R} = \frac{2tp}{2tp + fp + fn}`, see F1, see `F1-score <https://en.wikipedia.org/wiki/F1_score>`_
`F1-score`_
""" """
......
...@@ -185,3 +185,6 @@ Datasets ...@@ -185,3 +185,6 @@ Datasets
bob.ip.binseg.configs.datasets.drionsdb.expert1 bob.ip.binseg.configs.datasets.drionsdb.expert1
bob.ip.binseg.configs.datasets.drionsdb.expert2 bob.ip.binseg.configs.datasets.drionsdb.expert2
.. include:: links.rst
...@@ -9,9 +9,6 @@ ...@@ -9,9 +9,6 @@
.. _pytorch: https://pytorch.org .. _pytorch: https://pytorch.org
.. _tabulate: https://pypi.org/project/tabulate/ .. _tabulate: https://pypi.org/project/tabulate/
.. _our paper: https://arxiv.org/abs/1909.03856 .. _our paper: https://arxiv.org/abs/1909.03856
.. _precision and recall: https://en.wikipedia.org/wiki/Precision_and_recall
.. _f1-score: https://en.wikipedia.org/wiki/F1_score
.. _jaccard index: https://en.wikipedia.org/wiki/Jaccard_index
.. Raw data websites .. Raw data websites
.. _drive: https://www.isi.uu.nl/Research/Databases/DRIVE/ .. _drive: https://www.isi.uu.nl/Research/Databases/DRIVE/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment