Belle II Software  light-2403-persian
PerfectMasses Class Reference
Inheritance diagram for PerfectMasses:
Collaboration diagram for PerfectMasses:

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.
 

Private Attributes

 _per_corrects
 Good samples.
 
 _num_examples
 Total samples.
 

Detailed Description

Computes the rate of events with perfectly predicted mass hypotheses over a batch.

``output_transform`` should return the following items: ``(x_pred, x_y, u_y, batch, num_graphs)``.

* ``x_pred`` must contain node prediction logits and have shape (num_nodes_in_batch, node_classes);
* ``x_y`` must contain node ground-truth class indices and have shape (num_nodes_in_batch, 1);
* ``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 112 of file metrics.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  ignore_index,
  output_transform,
  device = 'cpu' 
)
Initialization.

Definition at line 135 of file metrics.py.

Member Function Documentation

◆ compute()

def compute (   self)
Final computation.

Definition at line 194 of file metrics.py.

◆ reset()

def reset (   self)
Resets counts.

Definition at line 151 of file metrics.py.

◆ update()

def update (   self,
  output 
)
Updates counts.

Definition at line 161 of file metrics.py.


The documentation for this class was generated from the following file: