Skip to content

Commit aa0f001

Browse files
committed
Merge branch 'f_beta_update' of https://github.com/PyTorchLightning/metrics into f_beta_update
2 parents 6eb4dcc + 5e7c2d3 commit aa0f001

File tree

3 files changed

+24
-30
lines changed

3 files changed

+24
-30
lines changed

.github/workflows/docs-check.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
# First run the same pipeline as Read-The-Docs
9090
cd docs
9191
make clean
92-
make html --debug --jobs 2 SPHINXOPTS="-W"
92+
make html --debug --jobs 2 SPHINXOPTS="-W --keep-going"
9393
9494
- name: Upload built docs
9595
uses: actions/upload-artifact@v2

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ test: clean env
2222

2323
docs: clean
2424
pip install --quiet -r docs/requirements.txt
25-
python -m sphinx -b html -W docs/source docs/build
25+
python -m sphinx -b html -W --keep-going docs/source docs/build
2626

2727
env:
2828
pip install -r requirements.txt

torchmetrics/functional/classification/f_beta.py

+22-28
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def fbeta(
8686
Computes f_beta metric.
8787
8888
.. math::
89-
F_\beta = (1 + \beta^2) * \frac{\text{precision} * \text{recall}}
89+
F_{\beta} = (1 + \beta^2) * \frac{\text{precision} * \text{recall}}
9090
{(\beta^2 * \text{precision}) + \text{recall}}
9191
9292
Works with binary, multiclass, and multilabel data.
@@ -108,15 +108,15 @@ def fbeta(
108108
average:
109109
Defines the reduction that is applied. Should be one of the following:
110110
111-
- ``'micro'`` [default]: Calculate the metric globally, accross all samples and classes.
112-
- ``'macro'``: Calculate the metric for each class separately, and average the
113-
metrics accross classes (with equal weights for each class).
114-
- ``'weighted'``: Calculate the metric for each class separately, and average the
115-
metrics accross classes, weighting each class by its support (``tp + fn``).
116-
- ``'none'`` or ``None``: Calculate the metric for each class separately, and return
117-
the metric for every class.
118-
- ``'samples'``: Calculate the metric for each sample, and average the metrics
119-
across samples (with equal weights for each sample).
111+
- ``'micro'`` [default]: Calculate the metric globally, accross all samples and classes.
112+
- ``'macro'``: Calculate the metric for each class separately, and average the
113+
metrics accross classes (with equal weights for each class).
114+
- ``'weighted'``: Calculate the metric for each class separately, and average the
115+
metrics accross classes, weighting each class by its support (``tp + fn``).
116+
- ``'none'`` or ``None``: Calculate the metric for each class separately, and return
117+
the metric for every class.
118+
- ``'samples'``: Calculate the metric for each sample, and average the metrics
119+
across samples (with equal weights for each sample).
120120
121121
.. note:: What is considered a sample in the multi-dimensional multi-class case
122122
depends on the value of ``mdmc_average``.
@@ -125,38 +125,32 @@ def fbeta(
125125
Defines how averaging is done for multi-dimensional multi-class inputs (on top of the
126126
``average`` parameter). Should be one of the following:
127127
128-
- ``None`` [default]: Should be left unchanged if your data is not multi-dimensional
129-
multi-class.
130-
131-
- ``'samplewise'``: In this case, the statistics are computed separately for each
132-
sample on the ``N`` axis, and then averaged over samples.
133-
The computation for each sample is done by treating the flattened extra axes ``...``
134-
(see :ref:`references/modules:input types`) as the ``N`` dimension within the sample,
135-
and computing the metric for the sample based on that.
136-
137-
- ``'global'``: In this case the ``N`` and ``...`` dimensions of the inputs
138-
(see :ref:`references/modules:input types`)
139-
are flattened into a new ``N_X`` sample axis, i.e. the inputs are treated as if they
140-
were ``(N_X, C)``. From here on the ``average`` parameter applies as usual.
128+
- ``None`` [default]: Should be left unchanged if your data is not multi-dimensional
129+
multi-class.
130+
- ``'samplewise'``: In this case, the statistics are computed separately for each
131+
sample on the ``N`` axis, and then averaged over samples.
132+
The computation for each sample is done by treating the flattened extra axes ``...``
133+
(see :ref:`references/modules:input types`) as the ``N`` dimension within the sample,
134+
and computing the metric for the sample based on that.
135+
- ``'global'``: In this case the ``N`` and ``...`` dimensions of the inputs
136+
(see :ref:`references/modules:input types`)
137+
are flattened into a new ``N_X`` sample axis, i.e. the inputs are treated as if they
138+
were ``(N_X, C)``. From here on the ``average`` parameter applies as usual.
141139
142140
ignore_index:
143141
Integer specifying a target class to ignore. If given, this class index does not contribute
144142
to the returned score, regardless of reduction method. If an index is ignored, and ``average=None``
145143
or ``'none'``, the score for the ignored class will be returned as ``nan``.
146-
147144
num_classes:
148145
Number of classes. Necessary for ``'macro'``, ``'weighted'`` and ``None`` average methods.
149-
150146
threshold:
151147
Threshold probability value for transforming probability predictions to binary
152148
(0,1) predictions, in the case of binary or multi-label inputs.
153149
top_k:
154150
Number of highest probability entries for each sample to convert to 1s - relevant
155151
only for inputs with probability predictions. If this parameter is set for multi-label
156152
inputs, it will take precedence over ``threshold``. For (multi-dim) multi-class inputs,
157-
this parameter defaults to 1.
158-
159-
Should be left unset (``None``) for inputs with label predictions.
153+
this parameter defaults to 1. Should be left unset (``None``) for inputs with label predictions.
160154
is_multiclass:
161155
Used only in certain special cases, where you want to treat inputs as a different type
162156
than what they appear to be. See the parameter's

0 commit comments

Comments
 (0)