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:
StrEnumUNU.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:
objectConfiguration for a UNU.RAN sampling method.
- Parameters:
method (
UnuranMethod) – The sampling method to use. IfUnuranMethod.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 methodsuse_ppf (
bool, defaultTrue) – IfTrue, prefer using PPF (inverse CDF) when available. This is typically the fastest method for univariate distributions.use_pdf (
bool, defaultTrue) – IfTrue, allow using PDF for rejection-based methods.use_cdf (
bool, defaultTrue) – IfTrue, allow using CDF for inversion-based methods.use_registry_characteristics (
bool, defaultTrue) – IfTrue, allow using distribution characteristics from the registry in addition to those directly available in the Distribution object. IfFalse, use only characteristics that are directly available in the Distribution object, without querying the registry.use_fallback_sampler (
bool, defaultTrue) – IfTrue, fall back toDefaultSamplingUnivariateStrategywhen UNU.RAN initialization fails (e.g. non-integer discrete support). IfFalse, the originalRuntimeErroris 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 useWhen
use_registry_characteristicsisTrue, characteristics may be retrieved from the distribution registry if not directly available in the Distribution object
-
method:
UnuranMethod
- __init__(method=UnuranMethod.AUTO, method_params=None, use_ppf=True, use_pdf=True, use_cdf=True, use_registry_characteristics=True, use_fallback_sampler=True)