avalanche.evaluation.metric_results.MetricValue

class avalanche.evaluation.metric_results.MetricValue(origin: Metric, name: str, value: Union[float, int, str, Tensor, Image, TensorImage, Figure, AlternativeValues], x_plot: int, logging_type: LoggingType = LoggingType.ANY)[source]

The result of a Metric.

A result has a name, a value and a “x” position in which the metric value should be plotted.

The “value” field can also be an instance of “AlternativeValues”, in which case it means that alternative representations exist for this value. For instance, the Confusion Matrix can be represented both as a Tensor and as an Image. It’s up to the Logger, according to its capabilities, decide which representation to use.

__init__(origin: Metric, name: str, value: Union[float, int, str, Tensor, Image, TensorImage, Figure, AlternativeValues], x_plot: int, logging_type: LoggingType = LoggingType.ANY)[source]

Creates an instance of MetricValue.

Parameters
  • origin – The originating Metric instance.

  • name – The display name of this value. This value roughly corresponds to the name of the plot in which the value should be logged.

  • value – The value of the metric. Can be a scalar value, a PIL Image, or a Tensor. If more than a possible representation of the same value exist, an instance of AlternativeValues can be passed. For instance, the Confusion Matrix can be represented both as an Image and a Tensor, in which case an instance of AlternativeValues carrying both the Tensor and the Image is more appropriate. The Logger instance will then select the most appropriate way to log the metric according to its capabilities.

  • x_plot – The position of the value. This value roughly corresponds to the x-axis position of the value in a plot. When logging a singleton value, pass 0 as a value for this parameter.

  • logging_type – determines how the metric should be logged.

Methods

__init__(origin, name, value, x_plot[, ...])

Creates an instance of MetricValue.