Shortcuts

CovAtxRisk

class torch_uncertainty.metrics.classification.CovAtxRisk(risk_threshold, **kwargs)[source]

Coverage at x Risk.

If there are multiple coverage values corresponding to the given risk, i.e., the risk(coverage) is not monotonic, the coverage at x risk is the maximum coverage value corresponding to the given risk. If no there is no coverage value corresponding to the given risk, return float(“nan”).

Parameters:
  • risk_threshold (float) – The risk threshold at which to compute the coverage.

  • kwargs – Additional arguments to pass to the metric class.

compute()[source]

Compute the coverage at x Risk.

Returns:

The coverage at x risk.

Return type:

Tensor

update(probs, targets)[source]

Store the scores and their associated errors for later computation.

Parameters:
  • probs (Tensor) – The predicted probabilities of shape \((N, C)\).

  • targets (Tensor) – The ground truth labels of shape \((N,)\).