support
Support Structures for Probability Distributions
This module defines support structures for probability distributions, including continuous intervals and discrete point sets.
Support defines the set of values where a probability distribution is defined (non-zero probability for discrete, non-zero density for continuous).
- class pysatl_core.distributions.support.Support(*args, **kwargs)[source]
Bases:
ProtocolProtocol for distribution support structures.
Support defines the set of values where a distribution is defined.
- contains(**kwds)
Helper for @overload to raise when called.
- __init__(*args, **kwargs)
- class pysatl_core.distributions.support.ContinuousSupport(left=-inf, right=inf, left_closed=True, right_closed=True)[source]
Bases:
Interval1D,SupportSupport for continuous distributions represented as an interval.
This class inherits from Interval1D and implements the Support protocol for continuous distributions defined on an interval [left, right].
- class pysatl_core.distributions.support.DiscreteSupport(*args, **kwargs)[source]
-
Protocol for discrete distribution supports.
Discrete supports consist of distinct points where the distribution has non-zero probability mass.
- iter_points()[source]
Iterate through all points in the support.
- Return type:
Iterator[TypeAliasType]
- class pysatl_core.distributions.support.ExplicitTableDiscreteSupport(points, assume_sorted=False)[source]
Bases:
DiscreteSupportDiscrete support defined by an explicit list of points.
This implementation stores points in a sorted array for efficient membership testing and iteration.
- Parameters:
- _points
Sorted unique points array.
- Type:
- contains(x)[source]
Check if point(s) are in the support.
- Parameters:
x (
NumberorNumericArray) – Point(s) to check.- Returns:
True for points in the support, False otherwise.
- Return type:
boolorBoolArray
- iter_points()[source]
Iterate through all points in the support.
- Return type:
Iterator[TypeAliasType]
- iter_leq(x)[source]
Iterate through points less than or equal to x.
- Parameters:
x (
Number) – Upper bound.- Return type:
Iterator[TypeAliasType]
- prev(x)[source]
Find the largest point strictly less than x.
- Parameters:
x (
Number) – Reference point.- Return type:
TypeAliasType|None
- next(current)[source]
Find the smallest point strictly greater than current.
- Parameters:
current (
Number) – Reference point.- Return type:
TypeAliasType|None
- property points: NumericArray
Get a copy of the points array.
- class pysatl_core.distributions.support.IntegerLatticeDiscreteSupport(residue, modulus, min_k=None, max_k=None)[source]
Bases:
DiscreteSupportDiscrete support defined by an integer lattice: {residue + k * modulus}.
- Parameters:
- Raises:
ValueError – If modulus is not positive.
- contains(x)[source]
Check if point(s) are in the integer lattice support.
Points must be integers satisfying: x = residue (mod modulus) and be within bounds if min_k/max_k are specified.
- Return type:
bool|TypeAliasType- Parameters:
x (Number | NumericArray)
- iter_points()[source]
Iterate through all points in the integer lattice support. :rtype:
Iterator[int]Note
If bounded from above and unbounded from below then iterates from upper bound in decreasing order
- Raises:
RuntimeError – If both min_k and max_k are None (unbounded both ways).
- Return type:
- iter_leq(x)[source]
Iterate through points less than or equal to x.
- Raises:
RuntimeError – If min_k is None (left-unbounded support).
- Return type:
- Parameters:
x (Number)
- __init__(residue, modulus, min_k=None, max_k=None)
- __iter__()
Iterate through all points in the integer lattice support. :rtype:
Iterator[int]Note
If bounded from above and unbounded from below then iterates from upper bound in decreasing order
- Raises:
RuntimeError – If both min_k and max_k are None (unbounded both ways).
- Return type: