probly.representation.credal_set.array.ArrayDistanceBasedCredalSet¶
- class probly.representation.credal_set.array.ArrayDistanceBasedCredalSet(nominal: ArrayCategoricalDistribution, radius: ndarray)[source]¶
Bases:
ArrayAxisProtected[ArrayCategoricalDistribution],ArrayCategoricalCredalSet,DistanceBasedCredalSetDistance-based credal set around a nominal categorical distribution.
- astype(dtype: DTypeLike, order: Order = 'K', casting: Literal['no', 'equiv', 'safe', 'same_kind', 'unsafe'] = 'unsafe', subok: bool = True, copy: bool = True) Self[source]¶
Copy of the array, cast to a specified type.
- property barycenter: ArrayCategoricalDistribution¶
Return the nominal distribution as the barycenter of the credal set.
- property flags: ArrayFlagsLike¶
The flags of the array.
- classmethod from_array_sample(sample: ArraySample[ArrayCategoricalDistribution]) Self[source]¶
Create a credal set from categorical distribution samples.
- classmethod from_sample(sample: Sample[ArrayCategoricalDistribution]) 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).
- nominal: ArrayCategoricalDistribution¶
- permitted_functions = {}¶
- permitted_ufuncs = {}¶
- protected_values(func: Callable | None = None, method: str | None = None) dict[str, ArrayProtectedValue] | None[source]¶
Return all protected field values.
The values are preserved as-is and are not coerced to
np.ndarray. Optionally takes the function that triggered the call for context. This can be used to conditionally modify the returned values or prevent them from being accessed.
- radius: np.ndarray¶
- reshape(*shape: int | tuple[int, ...], order: str = 'C', copy: bool | None = None) Self[source]¶
Return a copy with reshaped protected values.
- transpose(*axes: int | None) Self[source]¶
Return a transposed version of the ArraySample.
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 ArraySample.
- 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).