Skip to content

Types API

deepuq.types contains the shared container types used across the UQ APIs. The most important one is UQResult, which gives every predict_uq(...) helper a common return shape.

UQResult at a glance

Field Type Meaning
mean torch.Tensor predictive mean; for classifiers this often mirrors probs
epistemic_var torch.Tensor \| None uncertainty due to model/posterior uncertainty
aleatoric_var torch.Tensor \| None uncertainty due to observation noise
total_var torch.Tensor \| None total predictive variance
probs torch.Tensor \| None predictive class probabilities
probs_var torch.Tensor \| None probability-space disagreement/variance
metadata dict[str, Any] backend, sample-count, or likelihood metadata

Usage notes

  • Regression methods should treat mean as the primary prediction and populate variance fields where available.
  • Classification methods should prefer probs and probs_var; mean may mirror probs for convenience.
  • metadata is intentionally open-ended. Use it for non-tensor method details such as n_members, n_mc, likelihood, or hessian_structure.

deepuq.types

Shared public types for Deep-UQ outputs.

UQResult dataclass

Standardized uncertainty output container.

Fields are method-agnostic and can be partially populated depending on the inference algorithm and task type.

Parameters:

Name Type Description Default
mean Tensor

Predictive mean tensor for regression-style outputs. For classification methods this usually stores the same value as probs for convenience.

required
epistemic_var Tensor | None

Variance attributed to model or posterior uncertainty. Present for methods that expose between-sample or between-model spread.

None
aleatoric_var Tensor | None

Variance attributed to data noise or likelihood noise. Present only for methods that model observation noise explicitly.

None
total_var Tensor | None

Total predictive variance. When both epistemic and aleatoric terms are available this should be their sum.

None
probs Tensor | None

Predictive class probabilities for classification methods.

None
probs_var Tensor | None

Probability-space variance or disagreement summary for classification methods.

None
metadata dict[str, Any]

Free-form method metadata such as backend, sample count, or likelihood settings.

dict()