sampling

Sampling helpers for generated segments.

pysatl_cpd.data.generator.segments.sampling.feature_names_for_distribution(distribution)[source]

Extract feature names from a distribution specification.

Parameters:

distribution (MultivariateNormalSpec | IndependentColumnsSpec | NormalSpec | UniformSpec | ExponentialSpec | StudentTSpec) – Distribution specification to extract feature names from.

Returns:

Tuple of feature names for the distribution.

Return type:

tuple[str, ...]

Raises:

TypeError – If the distribution type is not supported.

pysatl_cpd.data.generator.segments.sampling.sample_distribution(distribution, length, rng)[source]

Sample data from a distribution specification.

Parameters:
Returns:

Array of sampled data with shape (length, num_features).

Return type:

ndarray[tuple[int, ...], dtype[double]]

Raises:

TypeError – If the distribution type is not supported.

pysatl_cpd.data.generator.segments.sampling.sample_univariate_distribution(distribution, length, rng)[source]

Sample from a univariate distribution specification.

Parameters:
Returns:

Array of sampled values.

Return type:

ndarray[tuple[int, ...], dtype[double]]

Raises:

TypeError – If the distribution type is not supported.

pysatl_cpd.data.generator.segments.sampling.build_covariance_matrix(covariance, dimension)[source]

Construct a covariance matrix from supported covariance inputs.

Parameters:
Returns:

Properly shaped covariance matrix.

Return type:

ndarray[tuple[int, ...], dtype[double]]

Raises:

ValueError – If the covariance input does not match the expected dimension.