Skip to content

Commit e2fecf2

Browse files
Added sub heading to ignite.metrics (#2448)
* Added sub heading to ignite.metrics * Updated docs for metrics * updated docs for ignite.metrics * improved the explanation of metric computation * made minor changes to the texts * made a small change to the sentence construction * framed a sentence in a better way Co-authored-by: vfdev <vfdev.5@gmail.com>
1 parent 295f93b commit e2fecf2

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

docs/source/metrics.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,17 @@ 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-
In practice a user needs to attach the metric instance to an engine. The metric
8-
value is then computed using the output of the engine's ``process_function``:
7+
Attach Engine API
8+
------------------
9+
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+
help of three methods: :meth:`~ignite.metrics.metric.Metric.reset()`, :meth:`~ignite.metrics.metric.Metric.update()` and :meth:`~ignite.metrics.metric.Metric.compute()`.
13+
14+
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`.
15+
The :meth:`~ignite.metrics.metric.Metric.reset()` method is triggered on ``EPOCH_STARTED`` event and it is responsible to reset the metric to its initial state. The :meth:`~ignite.metrics.metric.Metric.update()` method is triggered
16+
on ``ITERATION_COMPLETED`` event as it updates the state of the metric using the passed batch output. And :meth:`~ignite.metrics.metric.Metric.compute()` is triggered on ``EPOCH_COMPLETED``
17+
event. It computes the metric based on its accumulated states. The metric value is computed using the output of the engine's ``process_function``:
918

1019
.. code-block:: python
1120

0 commit comments

Comments
 (0)