nnpd.nre.distributions ====================== .. py:module:: nnpd.nre.distributions .. autoapi-nested-parse:: Distribution interfaces, independent bounded priors, and exact samplers. Classes ------- .. autoapisummary:: nnpd.nre.distributions.Parameter nnpd.nre.distributions.Simulator nnpd.nre.distributions.Prior nnpd.nre.distributions.IndependentPrior Functions --------- .. autoapisummary:: nnpd.nre.distributions.grid_axis Module Contents --------------- .. py:class:: Parameter .. py:attribute:: name :type: str .. py:attribute:: low :type: float .. py:attribute:: high :type: float .. py:attribute:: options :type: dict .. py:function:: grid_axis(low: float, high: float, step: float) -> numpy.ndarray .. py:class:: Simulator Bases: :py:obj:`abc.ABC` Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: parameters :type: tuple[Parameter, ...] .. py:attribute:: observation_dim :type: int .. py:method:: sample(theta: numpy.ndarray, rng: numpy.random.Generator) -> numpy.ndarray :abstractmethod: One observation per parameter row; result shape (..., observation_dim). .. py:method:: log_likelihood(x: numpy.ndarray, theta: numpy.ndarray) -> numpy.ndarray :abstractmethod: Optional exact reference, not used by the NRE training objective. .. py:class:: Prior Bases: :py:obj:`abc.ABC` Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: parameters :type: tuple[Parameter, ...] .. py:method:: sample(size: int, rng: numpy.random.Generator) -> numpy.ndarray :abstractmethod: Draw shape (size, number_of_inferred_parameters). .. py:method:: log_prob(theta: numpy.ndarray) -> numpy.ndarray :abstractmethod: Log density or log mass with respect to the declared support measure. .. py:property:: support_axes :type: tuple[numpy.ndarray | None, ...] None means continuous; an array means discrete counting measure. .. py:property:: measure :type: str .. py:class:: IndependentPrior(parameters: tuple[Parameter, ...], definition: dict) Bases: :py:obj:`Prior` Uniform, truncated normal, bounded signed exponential, or grid per axis. A negative exponential rate is valid on a finite box; it is not an unbounded exponential distribution. Grid log_prob returns a mass, never a density. 'by_parameter' may override the default family for particular coordinates. .. py:attribute:: families .. py:attribute:: parameters .. py:attribute:: kinds .. py:property:: support_axes None means continuous; an array means discrete counting measure. .. py:method:: sample(size: int, rng: numpy.random.Generator) -> numpy.ndarray Draw shape (size, number_of_inferred_parameters). .. py:method:: log_prob(theta: numpy.ndarray) -> numpy.ndarray Log density or log mass with respect to the declared support measure.