probly.representation.distribution.array_categorical.ArrayCategoricalDistributionSample¶
- class probly.representation.distribution.array_categorical.ArrayCategoricalDistributionSample(array: D, sample_axis: int, weights: np.ndarray | None = None)[source]¶
Bases:
CategoricalDistributionSample[ArrayCategoricalDistribution],ArraySample[ArrayCategoricalDistribution]Sample type for empirical second-order categorical distributions.
- array: D¶
- 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.
- copy(order: Order = 'C') ArraySample[D][source]¶
Create a copy of the ArraySample.
- Returns:
A copy of the ArraySample.
- property dtype: DTypeLike¶
The data type of the underlying array.
- property flags: ArrayFlagsLike¶
The flags of the array.
- classmethod from_iterable(samples: Iterable[D], weights: Iterable[float] | None = None, sample_axis: SampleAxis = 'auto', dtype: DTypeLike | None = None, **_kwargs: Unpack[SampleParams]) Self[source]¶
Create an ArraySample from a sequence of samples.
- Parameters:
samples – The predictions to create the sample from.
weights – Optional weights for the samples.
sample_axis – The dimension along which samples are organized.
dtype – Desired data type of the array.
- Returns:
The created ArraySample.
- classmethod from_sample(sample: Sample[D], sample_axis: SampleAxis = 'auto', dtype: DTypeLike | None = None) Self[source]¶
Create a new Sample from an existing Sample.
- Parameters:
sample – The sample to create the new sample from.
kwargs – Parameters for sample creation.
- Returns:
The created Sample.
- move_sample_axis(new_sample_axis: int) ArraySample[D][source]¶
Return a new ArraySample with the sample dimension moved to new_sample_axis.
- Parameters:
new_sample_axis – The new sample dimension.
- Returns:
A new ArraySample with the sample dimension moved.
- sample_space[source]¶
alias of
ArrayCategoricalDistribution
- property samples: D¶
Return an iterator over the samples.
- 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.