computation

Computation Primitives and Conversions

Core building blocks for computing distribution characteristics and conversions between them (e.g., PDF to CDF, CDF to PPF).

This module provides: - FittedComputationMethod: fitted conversion method ready for use - FitterMethod: cacheable computation that performs expensive precomputation - EvaluatorMethod: lightweight direct computation called on every query - AnalyticalComputation: analytical computation provided directly by a distribution - Computation: protocol for computations that evaluate a single characteristic

class pysatl_core.distributions.computations.computation.AnalyticalComputation[In, Out](target, func)[source]

Bases: Generic[In, Out]

Analytical computation provided directly by a distribution.

Parameters:
__init__(target, func)
Parameters:
Return type:

None

target: GenericCharacteristicName
func: ComputationFunc[In, Out]
__call__(*args, **options)[source]

Evaluate the analytical function.

Overloads:
  • **options (Any) → Out

  • data (In), **options (Any) → Out

Parameters:
Return type:

Any

class pysatl_core.distributions.computations.computation.Computation[In, Out](*args, **kwargs)[source]

Bases: Protocol, Generic[In, Out]

Protocol for computations that evaluate a single characteristic.

target

Name of the characteristic this computation produces.

Type:

str

property target: GenericCharacteristicName
__init__(*args, **kwargs)
type pysatl_core.distributions.computations.computation.ComputationMethodUnion = FitterMethod | EvaluatorMethod

Union type for computation methods (fitter or evaluator).

type pysatl_core.distributions.computations.computation.Evaluator[In, Out] = Callable[[...], Any]
class pysatl_core.distributions.computations.computation.EvaluatorMethod(target, sources, evaluator)[source]

Bases: object

Lightweight direct computation method called on every query.

An evaluator does not perform expensive precomputation and returns the computed value directly rather than a FittedComputationMethod.

Parameters:
target: GenericCharacteristicName
sources: Sequence[GenericCharacteristicName]
evaluator: EvaluatorFunc
property cacheable: bool

Evaluators are not cacheable.

evaluate(distribution, *args, **options)[source]

Evaluate the computation directly.

Overloads:
Parameters:
  • distribution (Distribution) – Distribution to evaluate for.

  • *args (Any) – Optional positional data argument.

  • **options (Any) – Additional options.

Returns:

Computed result.

Return type:

NumericArray

prepare(distribution, **options)[source]

Create a lightweight fitted wrapper that binds the distribution.

This allows evaluator-based methods to be used in the same way as fitter-based methods when needed.

Return type:

FittedComputationMethod[NumericArray, NumericArray]

Parameters:
__init__(target, sources, evaluator)
Parameters:
Return type:

None

type pysatl_core.distributions.computations.computation.Fitter[In, Out] = Callable[[...], Any]
class pysatl_core.distributions.computations.computation.FittedComputationMethod[In, Out](target, sources, func)[source]

Bases: Generic[In, Out]

Fitted conversion method ready for use.

Parameters:
target: GenericCharacteristicName
sources: Sequence[GenericCharacteristicName]
func: ComputationFunc[In, Out]
__call__(*args, **options)[source]

Evaluate the fitted conversion.

Overloads:
  • **options (Any) → Out

  • data (In), **options (Any) → Out

Parameters:
Return type:

Any

__init__(target, sources, func)
Parameters:
Return type:

None

class pysatl_core.distributions.computations.computation.FitterMethod(target, sources, fitter)[source]

Bases: object

Cacheable computation method that performs expensive precomputation.

A fitter is called once per distribution to produce a FittedComputationMethod that can be cached and reused for subsequent evaluations.

Parameters:
target: GenericCharacteristicName
sources: Sequence[GenericCharacteristicName]
fitter: FitterFunc
property cacheable: bool

Whether it makes sense to cache the prepared method at strategy level.

fit(distribution, **options)[source]

Fit the computation method to a specific distribution.

Parameters:
  • distribution (Distribution) – Distribution to fit the computation method to.

  • **options (Any) – Additional options passed to the fitter.

Returns:

Fitted method ready for evaluation.

Return type:

FittedComputationMethod[NumericArray, NumericArray]

prepare(distribution, **options)[source]

Alias for fit().

Return type:

FittedComputationMethod[NumericArray, NumericArray]

Parameters:
__init__(target, sources, fitter)
Parameters:
Return type:

None

type pysatl_core.distributions.computations.computation.Method[In, Out] = AnalyticalComputation | FittedComputationMethod