probly.representation.distribution.array_gaussian

Numpy-based Gaussian distribution representation.

Classes

ArrayGaussian([mean, var, type, allowed_types])

Gaussian distribution with array parameters.

class probly.representation.distribution.array_gaussian.ArrayGaussian(mean=<property object>, var=<property object>, type='gaussian', allowed_types=(<class 'numpy.ndarray'>, <class 'numpy.generic'>, <class 'float'>, <class 'int'>))[source]

Bases: GaussianDistribution

Gaussian distribution with array parameters.

Parameters:
classmethod from_parameters(mean, var, dtype=None)[source]

Create an ArrayGaussian from mean and variance parameters.

Parameters:
  • mean (ArrayLike)

  • var (ArrayLike)

  • dtype (DTypeLike | None)

Return type:

ArrayGaussian

copy()[source]

Create a copy of the gaussian distribution.

Return type:

Self

sample(num_samples=1, rng=None)[source]

Draw samples and wrap them in an ArraySample (sample_axis=0).

Parameters:
Return type:

ArraySample[ndarray]

to_device(device)[source]

Move the underlying arrays to the specified device.

Parameters:

device (Literal['cpu'])

Return type:

Self

property T: Self

Return a new ArrayGaussian with transposed parameters.

allowed_types: tuple[type[ndarray] | type[generic] | type[float] | type[int], ...]
property device: str

Return the hardware device on which the arrays reside (CPU for NumPy).

property dtype: DTypeLike

The data type of the underlying array.

property entropy: ndarray

Return the total differential entropy of the Gaussian distribution.

mean: ndarray
property ndim: int

The number of dimensions of the underlying array.

property shape: tuple[int, ...]

The shape of the underlying array.

property size: int

The total number of elements in the underlying array.

type: Literal['gaussian']
var: ndarray