parametrizations

Parameterization classes and specifications for distribution families.

This module provides the core abstractions for defining different parameterizations of statistical distributions, including constraints validation and conversion between parameterization formats.

class pysatl_core.families.parametrizations.ParametrizationConstraint(description, check)[source]

Bases: object

Constraint on parameter values for a parametrization.

Parameters:
  • description (str) – Human-readable description of the constraint.

  • check (Callable[[Any], bool]) – Validation function that returns True if constraint is satisfied.

description: str
check: Callable[[Any], bool]
__init__(description, check)
Parameters:
Return type:

None

class pysatl_core.families.parametrizations.Parametrization[source]

Bases: ABC

Abstract base class for distribution parametrizations.

This class defines the interface for parametrizations, including parameter validation and conversion to base parametrization format.

property name: str

Get the name of this parametrization.

property parameters: dict[str, Any]

Get parameters as a dictionary.

property constraints: list[ParametrizationConstraint]

Get constraints for this parametrization.

validate()[source]

Validate all constraints for this parametrization.

Raises:

ValueError – If any constraint is not satisfied.

Return type:

None

transform_to_base_parametrization()[source]

Convert this parametrization to the base parametrization.

Returns:

Equivalent parameters in the base parametrization.

Return type:

Parametrization

Notes

Base implementation returns self. Subclasses should override if conversion to a different parametrization is needed.

pysatl_core.families.parametrizations.constraint(description)[source]

Decorator to mark an instance method as a parameter constraint.

Parameters:

description (str) – Human-readable description of the constraint.

Returns:

Decorator that marks the function as a constraint.

Return type:

Callable[[Callable[P, bool]], Callable[P, bool]]

Notes

The decorated function must be a predicate returning bool. Sets marker attributes on the function: - __is_constraint: True - __constraint_description: description

pysatl_core.families.parametrizations.parametrization(*, family, name)[source]

Decorator to register a class as a parametrization for a family.

Parameters:
  • family (ParametricFamily) – Family to register the parametrization with.

  • name (str) – Name of the parametrization.

Returns:

Class decorator that registers the parametrization.

Return type:

Callable[[type[Parametrization]], type[Parametrization]]

Notes

Automatically converts the class to a dataclass if not already one. Collects and registers constraint methods marked with @constraint.