Skip to content

Commit 6d385eb

Browse files
authored
Added links to all the metric files (#2474)
* Added links to all the metric files * Added required link to all the metrics * fixed a few errors
1 parent c202a9a commit 6d385eb

26 files changed

+69
-2
lines changed

Diff for: docs/source/metrics.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ ignite.metrics
44
Metrics provide a way to compute various quantities of interest in an online
55
fashion without having to store the entire output history of a model.
66

7+
.. _attach-engine:
8+
79
Attach Engine API
810
------------------
911

10-
The metrics as stated above are computed in a online fashion, which means that the metric instance accumulates some internal counters on
11-
each iteration and metric value is computed once the epoch is ended. Internal counters are reset after every epoch. In practice, this is done with the
12+
The metrics as stated above are computed in a online fashion, which means that the metric instance accumulates some internal counters on
13+
each iteration and metric value is computed once the epoch is ended. Internal counters are reset after every epoch. In practice, this is done with the
1214
help of three methods: :meth:`~ignite.metrics.metric.Metric.reset()`, :meth:`~ignite.metrics.metric.Metric.update()` and :meth:`~ignite.metrics.metric.Metric.compute()`.
1315

1416
Therefore, a user needs to attach the metric instance to the engine so that the above three methods can be triggered on execution of certain :class:`~ignite.engine.events.Events`.

Diff for: ignite/metrics/accumulation.py

+4
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ class Average(VariableAccumulation):
112112
113113
Examples:
114114
115+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
116+
115117
.. include:: defaults.rst
116118
:start-after: :orphan:
117119
@@ -213,6 +215,8 @@ class GeometricAverage(VariableAccumulation):
213215
214216
Examples:
215217
218+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
219+
216220
.. include:: defaults.rst
217221
:start-after: :orphan:
218222

Diff for: ignite/metrics/accuracy.py

+2
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ class Accuracy(_BaseClassification):
117117
118118
Examples:
119119
120+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
121+
120122
.. include:: defaults.rst
121123
:start-after: :orphan:
122124

Diff for: ignite/metrics/classification_report.py

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ def ClassificationReport(
3838
3939
Examples:
4040
41+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
42+
4143
.. include:: defaults.rst
4244
:start-after: :orphan:
4345

Diff for: ignite/metrics/confusion_matrix.py

+10
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class ConfusionMatrix(Metric):
4747
4848
Examples:
4949
50+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
51+
5052
.. include:: defaults.rst
5153
:start-after: :orphan:
5254
@@ -204,6 +206,8 @@ def IoU(cm: ConfusionMatrix, ignore_index: Optional[int] = None) -> MetricsLambd
204206
205207
Examples:
206208
209+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
210+
207211
.. include:: defaults.rst
208212
:start-after: :orphan:
209213
@@ -267,6 +271,8 @@ def mIoU(cm: ConfusionMatrix, ignore_index: Optional[int] = None) -> MetricsLamb
267271
268272
Examples:
269273
274+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
275+
270276
.. include:: defaults.rst
271277
:start-after: :orphan:
272278
@@ -356,6 +362,8 @@ def DiceCoefficient(cm: ConfusionMatrix, ignore_index: Optional[int] = None) ->
356362
357363
Examples:
358364
365+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
366+
359367
.. include:: defaults.rst
360368
:start-after: :orphan:
361369
@@ -423,6 +431,8 @@ def JaccardIndex(cm: ConfusionMatrix, ignore_index: Optional[int] = None) -> Met
423431
424432
Examples:
425433
434+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
435+
426436
.. include:: defaults.rst
427437
:start-after: :orphan:
428438

Diff for: ignite/metrics/epoch_metric.py

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ class EpochMetric(Metric):
4242
4343
Example:
4444
45+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
46+
4547
.. include:: defaults.rst
4648
:start-after: :orphan:
4749

Diff for: ignite/metrics/fbeta.py

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ def Fbeta(
4747
4848
Examples:
4949
50+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
51+
5052
.. include:: defaults.rst
5153
:start-after: :orphan:
5254

Diff for: ignite/metrics/frequency.py

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class Frequency(Metric):
1212
"""Provides metrics for the number of examples processed per second.
1313
1414
Examples:
15+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
16+
1517
.. code-block:: python
1618
1719
# Compute number of tokens processed

Diff for: ignite/metrics/gan/fid.py

+2
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ class FID(_BaseInceptionMetric):
9696
9797
Examples:
9898
99+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
100+
99101
.. include:: defaults.rst
100102
:start-after: :orphan:
101103

Diff for: ignite/metrics/gan/inception_score.py

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class InceptionScore(_BaseInceptionMetric):
4949
5050
Examples:
5151
52+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
53+
5254
.. include:: defaults.rst
5355
:start-after: :orphan:
5456

Diff for: ignite/metrics/loss.py

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ class Loss(Metric):
4242
and the Loss metric using an ``evaluator`` created with
4343
:meth:`~ignite.engine.create_supervised_evaluator` method.
4444
45+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
46+
4547
.. include:: defaults.rst
4648
:start-after: :orphan:
4749

Diff for: ignite/metrics/mean_absolute_error.py

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class MeanAbsoluteError(Metric):
3535
3636
``y_pred`` and ``y`` should have the same shape.
3737
38+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
39+
3840
.. include:: defaults.rst
3941
:start-after: :orphan:
4042

Diff for: ignite/metrics/mean_pairwise_distance.py

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class MeanPairwiseDistance(Metric):
3535
3636
``y_pred`` and ``y`` should have the same shape.
3737
38+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
39+
3840
.. include:: defaults.rst
3941
:start-after: :orphan:
4042

Diff for: ignite/metrics/mean_squared_error.py

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class MeanSquaredError(Metric):
3535
3636
``y_pred`` and ``y`` should have the same shape.
3737
38+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
39+
3840
.. include:: defaults.rst
3941
:start-after: :orphan:
4042

Diff for: ignite/metrics/metric.py

+3
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ class Metric(metaclass=ABCMeta):
150150
In the example below we show how to setup standard metric like Accuracy and the custom metric using by an
151151
``evaluator`` created with :meth:`~ignite.engine.create_supervised_evaluator` method.
152152
153+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
154+
153155
.. code-block:: python
154156
155157
# https://discuss.pytorch.org/t/how-access-inputs-in-custom-ignite-metric/91221/5
@@ -378,6 +380,7 @@ def attach(self, engine: Engine, name: str, usage: Union[str, MetricUsage] = Epo
378380
:attr:`ignite.metrics.metric.BatchWise.usage_name`.
379381
380382
Examples:
383+
381384
.. code-block:: python
382385
383386
metric = ...

Diff for: ignite/metrics/metrics_lambda.py

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class MetricsLambda(Metric):
2929
3030
Examples:
3131
32+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
33+
3234
.. include:: defaults.rst
3335
:start-after: :orphan:
3436

Diff for: ignite/metrics/multilabel_confusion_matrix.py

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ class MultiLabelConfusionMatrix(Metric):
4040
4141
Example:
4242
43+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
44+
4345
.. include:: defaults.rst
4446
:start-after: :orphan:
4547

Diff for: ignite/metrics/nlp/bleu.py

+2
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ class Bleu(Metric):
104104
105105
Examples:
106106
107+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
108+
107109
.. testcode::
108110
109111
from ignite.metrics.nlp import Bleu

Diff for: ignite/metrics/nlp/rouge.py

+6
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ class RougeN(_BaseRouge):
212212
213213
Examples:
214214
215+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
216+
215217
.. testcode::
216218
217219
from ignite.metrics import RougeN
@@ -282,6 +284,8 @@ class RougeL(_BaseRouge):
282284
283285
Examples:
284286
287+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
288+
285289
.. testcode::
286290
287291
from ignite.metrics import RougeL
@@ -347,6 +351,8 @@ class Rouge(Metric):
347351
348352
Examples:
349353
354+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
355+
350356
.. testcode::
351357
352358
from ignite.metrics import Rouge

Diff for: ignite/metrics/precision.py

+2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ class Precision(_BasePrecisionRecall):
8888
8989
Examples:
9090
91+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
92+
9193
.. include:: defaults.rst
9294
:start-after: :orphan:
9395

Diff for: ignite/metrics/psnr.py

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class PSNR(Metric):
3434
The output of the engine's ``process_function`` needs to be in format of
3535
``(y_pred, y)`` or ``{'y_pred': y_pred, 'y': y, ...}``.
3636
37+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
38+
3739
.. include:: defaults.rst
3840
:start-after: :orphan:
3941

Diff for: ignite/metrics/recall.py

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class Recall(_BasePrecisionRecall):
3535
3636
Examples:
3737
38+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
39+
3840
.. include:: defaults.rst
3941
:start-after: :orphan:
4042

Diff for: ignite/metrics/root_mean_squared_error.py

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class RootMeanSquaredError(MeanSquaredError):
3535
3636
``y_pred`` and ``y`` should have the same shape.
3737
38+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
39+
3840
.. include:: defaults.rst
3941
:start-after: :orphan:
4042

Diff for: ignite/metrics/running_average.py

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class RunningAverage(Metric):
2727
2828
Examples:
2929
30+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
31+
3032
.. include:: defaults.rst
3133
:start-after: :orphan:
3234

Diff for: ignite/metrics/ssim.py

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class SSIM(Metric):
3636
``y_pred`` and ``y`` can be un-normalized or normalized image tensors. Depending on that, the user might need
3737
to adjust ``data_range``. ``y_pred`` and ``y`` should have the same shape.
3838
39+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
40+
3941
.. include:: defaults.rst
4042
:start-after: :orphan:
4143

Diff for: ignite/metrics/top_k_categorical_accuracy.py

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class TopKCategoricalAccuracy(Metric):
3131
``(y_pred, y)`` or ``{'y_pred': y_pred, 'y': y, ...}``. If not, ``output_tranform`` can be added
3232
to the metric to transform the output into the form expected by the metric.
3333
34+
For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
35+
3436
.. include:: defaults.rst
3537
:start-after: :orphan:
3638

0 commit comments

Comments
 (0)