TorchDistanceBasedCredalSet¶
- class probly.representation.credal_set.torch.TorchDistanceBasedCredalSet(nominal: TorchCategoricalDistribution, radius: Tensor)[source]¶
Bases:
TorchAxisProtected[TorchDistanceBasedCredalSet,TorchDistanceBasedCredalSet,TorchDistanceBasedCredalSet,Never,TorchDistanceBasedCredalSet,Tensor,TorchDistanceBasedCredalSet],TorchCategoricalCredalSet,DistanceBasedCredalSetDistance-based credal set around a nominal categorical distribution.
- property T: ShapeResultT¶
Inverts the order of the dimensions of the underlying array.
- property barycenter: TorchCategoricalDistribution¶
Return the nominal distribution as the barycenter of the credal set.
- clone(*, memory_format: torch.memory_format = torch.preserve_format) OwnerT[source]¶
Return a copy of the array.
- 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.
- 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]¶
Compute the lower envelope of the credal set.
For L1/TV distance, the tightest element-wise lower bound is max(0, nominal - radius).
- property mH: ShapeResultT¶
The adjoint (conjugate) transposed version of the underlying array.
- property mT: ShapeResultT¶
The transposed version of the underlying array.
- nominal: TorchCategoricalDistribution¶
- permitted_functions = {}¶
- permute(*dims: torch.Size | int | tuple[int] | list[int]) ShapeResultT[source]¶
Return a permuted version of the array.
- primary_protected_name = 'nominal'¶
- protected_axes = {'nominal': 0, 'radius': 0}¶
- protected_values(func: Callable | None = None) dict[str, V] | None[source]¶
Read effective values as-is, optionally checking function permissions.
- radius: torch.Tensor¶
- 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_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.
- type = 'categorical'¶
- upper() Tensor[source]¶
Compute the upper envelope of the credal set.
For L1/TV distance, the tightest element-wise upper bound is min(1, nominal + radius).