avalanche.evaluation.metrics.Accuracy

class avalanche.evaluation.metrics.Accuracy[source]

The Accuracy metric. This is a standalone metric.

The metric keeps a dictionary of <task_label, accuracy value> pairs. and update the values through a running average over multiple <prediction, target> pairs of Tensors, provided incrementally. The “prediction” and “target” tensors may contain plain labels or one-hot/logit vectors.

Each time result is called, this metric emits the average accuracy across all predictions made since the last reset.

The reset method will bring the metric to its initial state. By default this metric in its initial state will return an accuracy value of 0.

__init__()[source]

Creates an instance of the standalone Accuracy metric.

By default this metric in its initial state will return an accuracy value of 0. The metric can be updated by using the update method while the running accuracy can be retrieved using the result method.

Methods

__init__()

Creates an instance of the standalone Accuracy metric.

reset([task_label])

Resets the metric. :param task_label: if None, reset the entire dictionary. Otherwise, reset the value associated to task_label.

result([task_label])

Retrieves the running accuracy.

update(predicted_y, true_y, task_labels)

Update the running accuracy given the true and predicted labels.