NumpyDistanceBasedCredalSet¶
- class probly.representation.credal_set.numpy.NumpyDistanceBasedCredalSet(nominal: NumpyCategoricalDistribution, radius: ndarray)[source]¶
Bases:
NumpyAxisProtected[NumpyDistanceBasedCredalSet,NumpyDistanceBasedCredalSet,NumpyDistanceBasedCredalSet,Never,NumpyDistanceBasedCredalSet,NDArray[bool],NumpyDistanceBasedCredalSet],NumpyCategoricalCredalSet,DistanceBasedCredalSetDistance-based credal set around a nominal categorical distribution.
- property T: ShapeResultT¶
The transposed version of the underlying array.
- astype(dtype: DTypeLike, order: Order = 'K', casting: Literal['no', 'equiv', 'safe', 'same_kind', 'unsafe'] = 'unsafe', subok: bool = True, copy: bool = True) OpResultT[source]¶
Cast each protected field using ndarray.astype’s casting and layout options.
- property barycenter: NumpyCategoricalDistribution¶
Return the nominal distribution as the barycenter of the credal set.
- property flags: ArrayFlagsLike¶
The flags of the array.
- classmethod from_numpy_sample(sample: NumpySample[NumpyCategoricalDistribution]) Self[source]¶
Create a credal set from categorical distribution samples.
- classmethod from_sample(sample: Sample[NumpyCategoricalDistribution]) Self[source]¶
Create a credal set from a sample of categorical distributions.
- lower() ndarray[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 mT: ShapeResultT¶
The transposed version of the underlying array.
- nominal: NumpyCategoricalDistribution¶
- permitted_functions = {}¶
- permitted_ufuncs = {}¶
- primary_protected_name = 'nominal'¶
- protected_axes = {'nominal': 0, 'radius': 0}¶
- protected_values(func: Callable | None = None, method: str | None = None) dict[str, NumpyProtectedValue] | None[source]¶
Read effective values, with optional NumPy function or ufunc permissions.
- radius: np.ndarray¶
- reshape(*shape: int | tuple[int, ...], order: str = 'C', copy: bool | None = None) ShapeResultT[source]¶
Return a copy with reshaped protected values.
- property shape: tuple[int, ...]¶
Read the logical shape without collecting fields unless all broadcast.
- transpose(*axes: int | Sequence[int] | None) ShapeResultT[source]¶
Return a transposed version of the NumpySample.
This method implicitly also provides full axis tracking support for - np.moveaxis - np.rollaxis Those functions call out to transpose methods for custom array types.
- Parameters:
axes – The axes to transpose.
- Returns:
A transposed version of the NumpySample.
- type = 'categorical'¶
- upper() ndarray[source]¶
Compute the upper envelope of the credal set.
For L1/TV distance, the tightest element-wise upper bound is min(1, nominal + radius).