probly.representation.credal_set.array.ArrayProbabilityIntervalsCredalSet

class probly.representation.credal_set.array.ArrayProbabilityIntervalsCredalSet(lower_bounds: ndarray, upper_bounds: ndarray)[source]

Bases: ArrayAxisProtected[ArrayCategoricalDistribution], ArrayCategoricalCredalSet, ProbabilityIntervalsCredalSet

Credal set represented by lower/upper categorical bounds.

property T: Self

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) Self[source]

Copy of the array, cast to a specified type.

property barycenter: ArrayCategoricalDistribution

Compute the barycenter of the credal set as the center of the probability intervals.

contains(probabilities: ndarray) ndarray[source]

Check whether probabilities are inside the intervals.

copy(order: Order = 'C') Self[source]

Return a copy of the array.

property device: str

Device of the array.

property dtype: dtype

Data type of the array.

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]

Return the lower probabilities of the credal set.

lower_bounds: np.ndarray
property mT: Self

The transposed version of the underlying array.

property ndim: int

Number of dimensions.

property num_classes: int

Return the number of classes in the credal set.

permitted_functions = {}
permitted_ufuncs = {}
classmethod primary_protected_name() str[source]

Return the first protected field (dict order).

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

Protected trailing shape of the primary field.

protected_value() ArrayProtectedValue[source]

Return the primary protected value.

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.

reshape(*shape: int | tuple[int, ...], order: str = 'C', copy: bool | None = None) Self[source]

Return a copy with reshaped protected values.

property shape: tuple[int, ...]

Shape of the array.

property size: int

Number of elements in the array.

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

Move the array to a device.

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]

Return the upper probabilities of the credal set.

upper_bounds: np.ndarray
width() ndarray[source]

Compute interval width for each class.

with_protected_value(value: ArrayProtectedValue) Self[source]

Return a copy with a replaced primary protected value.

with_protected_values(values: dict[str, ArrayProtectedValue]) Self[source]

Return a copy with updated protected field values.

Examples using probly.representation.credal_set.array.ArrayProbabilityIntervalsCredalSet

Plotting binary credal sets on an interval

Plotting binary credal sets on an interval

Plotting credal sets on the simplex

Plotting credal sets on the simplex

Plotting credal sets on a spider (radar) chart

Plotting credal sets on a spider (radar) chart

Probability-intervals credal set

Probability-intervals credal set