distribution

Distribution Interface

This module defines the public Distribution protocol that serves as the abstract interface for all probability distributions in the system.

class pysatl_core.distributions.distribution.Distribution(distribution_type, analytical_computations, support=None, sampling_strategy=None, computation_strategy=None)[source]

Bases: ABC

Protocol defining the interface for probability distributions.

This protocol is the central abstraction used throughout the system. Concrete distribution implementations must provide the properties and methods defined here.

Parameters:
distribution_type

Type information about the distribution (kind, dimension, etc.).

Type:

DistributionType

analytical_computations

GenericCharacteristicName, (

AnalyticalComputation[Any, Any] | Mapping[LabelName, AnalyticalComputation[Any, Any]]

),

Type:

Mapping[

]

Direct analytical computations provided by the distribution.

sampling_strategy

Strategy for generating random samples.

Type:

SamplingStrategy

computation_strategy

Strategy for computing characteristics and conversions.

Type:

ComputationStrategy

support

Support of the distribution, if defined.

Type:

Support or None

__init__(distribution_type, analytical_computations, support=None, sampling_strategy=None, computation_strategy=None)[source]

Initialize common distribution state.

Parameters:
  • distribution_type (DistributionType) – Type information about the distribution (kind, dimension, etc.).

  • analytical_computations (Mapping[GenericCharacteristicName, AnalyticalComputation[Any, Any] | Mapping[LabelName, AnalyticalComputation[Any, Any]]]) –

    Mapping[

    GenericCharacteristicName, (

    AnalyticalComputation[Any, Any] | Mapping[LabelName, AnalyticalComputation[Any, Any]]

    ),

    ] Analytical computations provided by the distribution.

  • support (Support or None, default None) – Support of the distribution.

  • sampling_strategy (SamplingStrategy or None, default None) – Sampling strategy instance. If omitted, univariate default is used.

  • computation_strategy (ComputationStrategy or None, default None) – Computation strategy instance. If omitted, default strategy is used.

Return type:

None

property distribution_type: pysatl_core.types.DistributionType

Return type metadata of the distribution (kind, dimension, etc.).

property analytical_computations: Mapping[GenericCharacteristicName, Mapping[LabelName, AnalyticalComputation[Any, Any]]]

Return analytical computations provided directly by this distribution.

property sampling_strategy: pysatl_core.distributions.strategies.SamplingStrategy

Return the currently attached sampling strategy.

property computation_strategy: pysatl_core.distributions.strategies.ComputationStrategy

Return the currently attached computation strategy.

property support: Support | None

Return the support of the distribution, if it is defined.

with_sampling_strategy(sampling_strategy)[source]

Return a copy of this distribution with an updated sampling strategy.

Return type:

Self

Parameters:

sampling_strategy (SamplingStrategy | None)

with_computation_strategy(computation_strategy)[source]

Return a copy of this distribution with an updated computation strategy.

Return type:

Self

Parameters:

computation_strategy (ComputationStrategy | None)

with_strategies(*, sampling_strategy=<object object>, computation_strategy=<object object>)[source]

Return a copy of this distribution with updated strategies.

Return type:

Self

Parameters:
query_method(characteristic_name, **options)[source]

Query a computation method for a specific characteristic.

Parameters:
  • characteristic_name (str) – Name of the characteristic to compute (e.g., “pdf”, “cdf”).

  • **options (Any) – Additional options for the computation.

Returns:

Callable method that computes the characteristic.

Return type:

Method

calculate_characteristic(characteristic_name, value, **options)[source]

Calculate a characteristic at the given value.

Parameters:
  • characteristic_name (str) – Name of the characteristic to compute.

  • value (Any) – Point(s) at which to evaluate the characteristic.

  • **options (Any) – Additional computation options.

Returns:

Value of the characteristic at the given point(s).

Return type:

Any

sample(n, **options)[source]

Generate random samples from the distribution.

Parameters:
  • n (int) – Number of samples to generate.

  • **options (Any) – Additional sampling options forwarded to the underlying sampling strategy.

Returns:

NumPy array containing n generated samples. The exact array shape depends on the distribution and the sampling strategy.

Return type:

NumericArray