probly.representation.distribution.array_gaussian.ArrayGaussianDistributionSample

class probly.representation.distribution.array_gaussian.ArrayGaussianDistributionSample(array: D, sample_axis: int, weights: np.ndarray | None = None)[source]

Bases: GaussianDistributionSample[ArrayGaussianDistribution], ArraySample[ArrayGaussianDistribution]

Sample type for empirical second-order Gaussian distributions.

property T: Self

The transposed version of the underlying array.

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.

concat(other: Sample[D]) Self[source]

Append another sample to this sample.

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

Create a copy of the ArraySample.

Returns:

A copy of the ArraySample.

property device: str

The device of the underlying array.

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.

property is_weighted: bool

Return whether the samples are weighted.

property mT: Self

The transposed version of the underlying array.

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.

property ndim: int

The number of dimensions of the underlying array.

sample_axis: int
sample_mean() D[source]

Compute the mean of the sample.

property sample_size: int

Return the number of samples.

sample_space[source]

alias of ArrayGaussianDistribution

sample_std(ddof: int = 0) D[source]

Compute the standard deviation of the sample.

sample_var(ddof: int = 0) D[source]

Compute the variance of the sample.

property samples: D

Return an iterator over the samples.

property shape: tuple[int, ...]

The shape of the underlying array.

property size: int

The total number of elements in the underlying 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.

weights: ndarray | None