probly.utils.torch.intersection_probability

probly.utils.torch.intersection_probability(lower: Tensor, upper: Tensor) Tensor[source]

Intersection probability of a probability interval, per [WCM+24] Section 3.4.

Reduces an interval credal set [lower, upper] to a single probability vector by q_int_k = lower_k + alpha * (upper_k - lower_k) with alpha = (1 - sum(lower)) / sum(upper - lower). The implementation handles the degenerate case upper == lower (zero width) by returning lower directly, avoiding 0 / 0 and keeping autograd well-defined.

Parameters:
  • lower – Lower bounds of shape (..., num_classes).

  • upper – Upper bounds of shape (..., num_classes).

Returns:

Intersection probability tensor of shape (..., num_classes).