You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/metrics.rst
+11-2
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,17 @@ ignite.metrics
4
4
Metrics provide a way to compute various quantities of interest in an online
5
5
fashion without having to store the entire output history of a model.
6
6
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``:
0 commit comments