![]() |
Belle II Software release-09-00-03
|


Public Member Functions | |
| def | __init__ (self, ignore_index, output_transform, device='cpu') |
| def | reset (self) |
| def | update (self, output) |
| def | compute (self) |
Public Attributes | |
| ignore_index | |
| Ignore index. | |
| device | |
| CPU or GPU. | |
Protected Attributes | |
| _per_corrects | |
| Good samples. | |
| _num_examples | |
| Total samples. | |
Computes the rate of perfectly predicted LCAS matrices over a batch.
``output_transform`` should return the following items: ``(edge_pred, edge_y, edge_index, u_y, batch, num_graphs)``.
* ``edge_pred`` must contain edge prediction logits and have shape (num_edges_in_batch, edge_classes);
* ``edge_y`` must contain edge ground-truth class indices and have shape (num_edges_in_batch, 1);
* ``edge index`` maps edges to its nodes;
* ``u_y`` is the signal/background class (always 1 in the current setting);
* ``batch`` maps nodes to their graph;
* ``num_graphs`` is the number of graph in a batch (could be derived from ``batch`` also).
.. seealso::
`Ignite metrics <https://pytorch.org/ignite/metrics.html>`_
:param ignore_index: Class or list of classes to ignore during the computation (e.g. padding).
:type ignore_index: list[int]
:param output_transform: Function to transform engine's output to desired output.
:type output_transform: `function <https://docs.python.org/3/glossary.html#term-function>`_
:param device: ``cpu`` or ``gpu``.
:type device: str
Definition at line 17 of file metrics.py.
| def __init__ | ( | self, | |
| ignore_index, | |||
| output_transform, | |||
device = 'cpu' |
|||
| ) |
Initialization.
Definition at line 41 of file metrics.py.
| def compute | ( | self | ) |
Final result.
Definition at line 101 of file metrics.py.
| def reset | ( | self | ) |
Resets counters.
Definition at line 57 of file metrics.py.
| def update | ( | self, | |
| output | |||
| ) |
Updates counts.
Definition at line 67 of file metrics.py.
|
protected |
Total samples.
Definition at line 52 of file metrics.py.
|
protected |
Good samples.
Definition at line 50 of file metrics.py.
| device |
CPU or GPU.
Definition at line 48 of file metrics.py.
| ignore_index |
Ignore index.
Definition at line 46 of file metrics.py.