TorchProbabilityIntervalsCredalSet

class probly.representation.credal_set.torch.TorchProbabilityIntervalsCredalSet(lower_bounds: Tensor, upper_bounds: Tensor)[source]

Bases: TorchAxisProtected[TorchProbabilityIntervalsCredalSet, TorchProbabilityIntervalsCredalSet, TorchProbabilityIntervalsCredalSet, Never, TorchProbabilityIntervalsCredalSet, Tensor, TorchProbabilityIntervalsCredalSet], TorchCategoricalCredalSet, ProbabilityIntervalsCredalSet

Credal set represented by lower/upper categorical bounds.

property T: ShapeResultT

Inverts the order of the dimensions of the underlying array.

property barycenter: TorchCategoricalDistribution

Return the barycenter of the credal set.

clone(*, memory_format: torch.memory_format = torch.preserve_format) → OwnerT[source]

Return a copy of the array.

contains(probabilities: Tensor) → Tensor[source]

Check whether probabilities are inside the intervals.

cpu(memory_format: memory_format = torch.preserve_format) → Self[source]

Move the array to the CPU.

cuda(device: device | str | None = None, non_blocking: bool = False, memory_format: memory_format = torch.preserve_format) → Self[source]

Move the array to the GPU.

detach() → Self[source]

Return a detached version of the array.

property device: device

Device of the array.

property dtype: dtype

Data type of the array.

classmethod from_sample(sample: Sample[TorchCategoricalDistribution]) → Self[source]

Create a credal set from a finite sample.

Parameters:

sample – The sample to create the credal set from.

Returns:

The created credal set.

classmethod from_torch_sample(sample: TorchSample[TorchCategoricalDistribution]) → Self[source]

Create a credal set from categorical distribution samples.

gather(dim: int, index: torch.Tensor) → ShapeResultT[source]

Return a copy with gathered protected values along a batch dimension.

lower() → Tensor[source]

Return the per-class lower probability envelope (alias for lower_bounds).

lower_bounds: torch.Tensor
property mH: ShapeResultT

The adjoint (conjugate) transposed version of the underlying array.

property mT: ShapeResultT

The transposed version of the underlying array.

property ndim: int

Number of dimensions.

property num_classes: int

Get the number of classes.

numpy(*, force: bool = False) → NDArray[Any][source]

Convert to a numpy array.

permitted_functions = {}
permute(*dims: torch.Size | int | tuple[int] | list[int]) → ShapeResultT[source]

Return a permuted version of the array.

primary_protected_name = 'lower_bounds'
protected_axes = {'lower_bounds': 1, 'upper_bounds': 1}
property protected_shape: tuple[int, ...]

Protected trailing shape of the primary field.

protected_value() → TorchProtectedValue[source]

Return the primary protected value.

protected_values(func: Callable | None = None) → dict[str, V] | None[source]

Read effective values as-is, optionally checking function permissions.

reshape(*shape: int | tuple[int, ...]) → ShapeResultT[source]

Return a copy with reshaped protected values.

resolve_conj() → OpResultT[source]

Return a version of the array with any conjugate operations resolved.

resolve_neg() → OpResultT[source]

Return a version of the array with any negation operations resolved.

property shape: tuple[int, ...]

Read the logical shape without collecting fields unless all broadcast.

size(dim: int | None = None) → int | Size[source]

Return the size of the array along the given dimension.

to(*args: Any, **kwargs: Any) → Self[source]

Move and/or cast the tensor, mirroring torch.Tensor.to.

to_device(device: device | str | None = None, /, *, stream: int | Any | None = None) → Self[source]

Move the array to the given device.

Parameters:
  • device – Target device, or None to retain the current device.

  • stream – Unsupported; must be None.

Returns:

The moved array representation.

Raises:

NotImplementedError – If a stream is provided.

transpose(dim0: int, dim1: int) → ShapeResultT[source]

Return a transposed version of the array.

type = 'categorical'
upper() → Tensor[source]

Return the per-class upper probability envelope (alias for upper_bounds).

upper_bounds: torch.Tensor
validate() → None[source]

Raise if effective fields have insufficient rank or incompatible batches.

Call explicitly, or from __post_init__ to check dataclass construction. Fields owned by initialization (init=False) are excluded.

width() → Tensor[source]

Compute interval width for each class.

with_protected_values(values: dict[str, TorchProtectedValue], func: Callable | None = None) → OwnerT | OpResultT | ShapeResultT | CompResultT | SetResultT[source]

Return a copy with updated protected field values.

Examples using probly.representation.credal_set.torch.TorchProbabilityIntervalsCredalSet

Credal DRO Output Visualization

Credal DRO Output Visualization

Credal Net Visualization

Credal Net Visualization

Credal Net on MNIST

Credal Net on MNIST

Credal Relative Likelihood Visualization

Credal Relative Likelihood Visualization

Credal Relative Likelihood on MNIST

Credal Relative Likelihood on MNIST

Credal Wrapper Output Visualization

Credal Wrapper Output Visualization

Credal Wrapper on MNIST

Credal Wrapper on MNIST

Efficient Credal Prediction Visualization

Efficient Credal Prediction Visualization

Efficient Credal Prediction on MNIST

Efficient Credal Prediction on MNIST