sampling

Sampling Interfaces

This module defines protocols and implementations for sample containers used in distribution sampling.

class pysatl_core.distributions.sampling.Sample(*args, **kwargs)[source]

Bases: Protocol

Protocol for sample containers.

array

Array representation of the samples.

Type:

numpy.ndarray

shape

Shape of the sample array.

Type:

tuple[int, ]

property array: npt.NDArray[np.floating[Any]]
property shape: tuple[int, ...]
__init__(*args, **kwargs)
class pysatl_core.distributions.sampling.ArraySample(data)[source]

Bases: object

Array-backed sample container.

This implementation stores samples as a 2D floating-point array of shape (n_samples, n_dimensions).

Parameters:

data (numpy.ndarray) – 2D floating-point array of shape (n, d).

data

Backing array containing the samples.

Type:

numpy.ndarray

dimension

Dimensionality of the samples (d).

Type:

int

Raises:

ValueError – If data is not 2D.

Parameters:

data (ndarray[tuple[Any, ...], dtype[floating[Any]]])

__init__(data)[source]
Parameters:

data (ndarray[tuple[Any, ...], dtype[floating[Any]]])

Return type:

None

data: ndarray[tuple[Any, ...], dtype[floating[Any]]]
dimension: int
__len__()[source]

Return the number of samples (n).

Return type:

int

property dim: int

Alias for dimension attribute.

__iter__()[source]

Iterate over samples (rows of the array).

Return type:

Iterator[ndarray[tuple[Any, ...], dtype[floating[Any]]]]

property array: ndarray[tuple[Any, ...], dtype[floating[Any]]]

Return the backing array.

property shape: tuple[int, ...]

Return the shape of the sample array (n, d).