method_config

class pysatl_core.sampling.unuran.method_config.UnuranMethod(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StrEnum

UNU.RAN sampling methods.

Methods are categorized by their approach: - Inversion methods: use inverse CDF - Rejection methods: accept/reject based on envelope - Transformation methods: transform from simpler distributions - Numerical inversion: approximate inverse CDF - Specialized methods: optimized for specific distribution types

AUTO = 'auto'
PINV = 'pinv'
TDR = 'tdr'
AROU = 'arou'
HINV = 'hinv'
NINV = 'ninv'
DGT = 'dgt'
class pysatl_core.sampling.unuran.method_config.UnuranMethodConfig(method=UnuranMethod.AUTO, method_params=None, use_ppf=True, use_pdf=True, use_cdf=True, use_registry_characteristics=True, use_fallback_sampler=True)[source]

Bases: object

Configuration for a UNU.RAN sampling method.

Parameters:
  • method (UnuranMethod) – The sampling method to use. If UnuranMethod.AUTO, UNU.RAN will automatically select the best method based on available distribution characteristics.

  • method_params (dict[str, Any], optional) – Method-specific parameters. The exact parameters depend on the chosen method. Common parameters include: - accuracy: target accuracy for numerical methods - max_iterations: maximum iterations for iterative methods - grid_size: grid size for interpolation methods - smooth: smoothing parameter for kernel methods

  • use_ppf (bool, default True) – If True, prefer using PPF (inverse CDF) when available. This is typically the fastest method for univariate distributions.

  • use_pdf (bool, default True) – If True, allow using PDF for rejection-based methods.

  • use_cdf (bool, default True) – If True, allow using CDF for inversion-based methods.

  • use_registry_characteristics (bool, default True) – If True, allow using distribution characteristics from the registry in addition to those directly available in the Distribution object. If False, use only characteristics that are directly available in the Distribution object, without querying the registry.

  • use_fallback_sampler (bool, default True) – If True, fall back to DefaultSamplingUnivariateStrategy when UNU.RAN initialization fails (e.g. non-integer discrete support). If False, the original RuntimeError is re-raised instead.

Notes

  • Method-specific parameters are validated when the sampler is created

  • Some methods require specific characteristics (e.g., rejection methods typically need PDF)

  • The use_* flags control which distribution characteristics can be used, but do not guarantee their use

  • When use_registry_characteristics is True, characteristics may be retrieved from the distribution registry if not directly available in the Distribution object

method: UnuranMethod
method_params: dict[str, Any] | None
use_ppf: bool
use_pdf: bool
use_cdf: bool
use_registry_characteristics: bool
use_fallback_sampler: bool
__post_init__()[source]

Validate configuration parameters.

Return type:

None

__init__(method=UnuranMethod.AUTO, method_params=None, use_ppf=True, use_pdf=True, use_cdf=True, use_registry_characteristics=True, use_fallback_sampler=True)
Parameters:
Return type:

None