avalanche.evaluation.metrics.confusion_matrix_metrics(num_classes=None, normalize=None, save_image=True, image_creator=<function default_cm_image_creator>, class_names=None, stream=False, wandb=False, absolute_class_order: bool = False) List[avalanche.evaluation.metric_definitions.PluginMetric][source]

Helper method that can be used to obtain the desired set of plugin metrics.

  • num_classes – The number of classes. Defaults to None, which means that the number of classes will be inferred from ground truth and prediction Tensors (see class description for more details). If not None, the confusion matrix will always be of size num_classes, num_classes and only the first num_classes values of output logits or target logits will be considered in the update. If the output or targets are provided as numerical labels, there can be no label greater than num_classes.

  • normalize – Normalizes confusion matrix over the true (rows), predicted (columns) conditions or all the population. If None, confusion matrix will not be normalized. Valid values are: ‘true’, ‘pred’ and ‘all’ or None.

  • save_image – If True, a graphical representation of the confusion matrix will be logged, too. If False, only the Tensor representation will be logged. Defaults to True.

  • image_creator – A callable that, given the tensor representation of the confusion matrix, returns a graphical representation of the matrix as a PIL Image. Defaults to default_cm_image_creator.

  • class_names – W&B only. List of names for the classes. E.g. [“cat”, “dog”] if class 0 == “cat” and class 1 == “dog” If None, no class names will be used. Default None.

  • stream – If True, will return a metric able to log the confusion matrix averaged over the entire evaluation stream of experiences.

  • wandb – if True, will return a Weights and Biases confusion matrix together with all the other confusion matrixes requested.

  • absolute_class_order

    Not W&B. If true, the labels in the created image will be sorted by id, otherwise they will be sorted by order of encounter at training time. This parameter is ignored if save_image is

    False, or the scenario is not a NCScenario.


A list of plugin metrics.