SetSize#

class torch_uncertainty.metrics.classification.SetSize(reduction='mean', **kwargs)[source]#

Set size to compute the efficiency of conformal prediction methods.

Parameters:
  • reduction (Optional[Literal['mean', 'sum', 'none']]) –

    Determines how to reduce over the \(B\)/batch dimension:

    • 'mean' [default]: Averages score across samples

    • 'sum': Sum score across samples

    • 'none' or None: Returns score per sample

  • kwargs – Additional keyword arguments, see Advanced metric settings.

compute()[source]#

Compute the set size.

Returns:

The set size according to the selected reduction.

Return type:

Tensor

update(preds, targets=None)[source]#

Update the metric state with predictions and targets.

Parameters:
  • preds (Tensor) – Predicted sets tensor of shape (B, C), where B is the batch size and C is the number of classes.

  • targets (Tensor | None) – Unused. Kept for API consistency. Defaults to None.

Return type:

None