Metric Template
metric_template is the base class for all user-defined training metrics.
It inherits from both tools and notification, and provides helpers for
computing per-event and per-batch statistics during model training, validation,
and evaluation. It also exposes ROOT tree output helpers (register_output,
write) and the same particle combination utilities as selection_template.
Struct: metric_t
Header: <templates/metric_template.h>
metric_t is constructed by the framework and passed to
metric_template::define_metric for each graph in the batch.
Field |
Type |
Description |
|---|---|---|
|
|
Current k-fold index. |
|
|
Current training epoch. |
|
|
CUDA device index (0 = first GPU, -1 = CPU). |
Public Method
Signature |
Description |
|---|---|
|
Retrieves the named graph/node/edge variable of type g from the variable store for this event. Prints an error and returns default if the variable is not found. |
|
Returns the training mode string ( |
|
Returns a pointer to the filename of graph at batch position idx. |
Class: metric_template
Header: <templates/metric_template.h>
Inheritance: tools, notification
Properties
Property |
Type |
Description |
|---|---|---|
|
|
Metric class name. Settable/Gettable. |
|
|
Directory for ROOT output files. Gettable. |
|
|
List of variable names requested from |
|
|
Maps model-name → run-label used for output file organisation. |
Virtual Methods (Override in Subclass)
Signature |
Description |
|---|---|
|
Returns a heap-allocated copy of the metric. |
|
Called once before training. Use |
|
Called once per graph during training/validation/evaluation.
Use |
|
Called after |
|
Called after a full batch is processed. |
|
Called at the end of an epoch. |
Output Methods
Signature |
Description |
|---|---|
|
Creates an output ROOT branch |
|
Fills the branch |
Particle Utilities (same as selection_template)
metric_template exposes the same sum, safe_delete, make_unique,
vectorize helpers as selection_template; see that page for documentation.
Additionally:
Signature |
Description |
|---|---|
|
Constructs a vector of |