Skip to content

Classification metrics

ClassificationOutputs #

Bases: TypedDict

The outputs that should be minimally returned from the training/val/test_step of classification LightningModules so that metrics can be added aumatically by the ClassificationMetricsCallback.

loss instance-attribute #

loss: NotRequired[Tensor | float]

The loss at this step.

logits instance-attribute #

logits: Required[Tensor]

The un-normalized logits.

y instance-attribute #

y: Required[Tensor]

The class labels.

ClassificationMetricsCallback #

Bases: Callback[BatchType, ClassificationOutputs]

Callback that adds classification metrics to a LightningModule.