latte.metrics.base
Module Contents
Classes
Base class for Latte metric objects. |
|
Base class for metric bundles |
|
Just a type alias for metric bundles with optimized implementation. These bundles are in fact LatteMetric objects, but they are functionally more similar to MetricBundle objects. |
Attributes
A 'fake' super class of MetricBundle and OptimizedMetricBundle. This is used to make the type checker happy. |
- class LatteMetric
Bases:
abc.ABCBase class for Latte metric objects.
Adapted from TorchMetrics implementation.
- add_state(name, default)
Create a state variable for the metric.
- abstract update_state()
Update metric states
- reset_state()
Reset the states of the metric to the defaults.
- abstract compute()
Compute metric value(s)
- class MetricBundle(metrics)
Base class for metric bundles
- Parameters:
metrics (Union[List[LatteMetric], Dict[str, LatteMetric]]) – A list of metrics or a dictionary of metric names mapping to metrics. If a list is provided, the key for each metric in the output will be the name of the metric.
- update_state(**kwargs)
Update the internal states of all metric submodules. Currently, all arguments must be passed as a keyword argument to this function to allow correct mapping to respective metric submodules.
- reset_state()
Reset the state of all metric submodules.
- class OptimizedMetricBundle
Bases:
LatteMetricJust a type alias for metric bundles with optimized implementation. These bundles are in fact LatteMetric objects, but they are functionally more similar to MetricBundle objects.
- BaseMetricBundle
A ‘fake’ super class of MetricBundle and OptimizedMetricBundle. This is used to make the type checker happy.