Random

pmrf.parameters.Random(distribution: AbstractDistribution, *, constraint: AbstractConstraint | None = None, value: Array | ndarray | bool | number | bool | int | float | complex | None = None, fixed: bool = False, name: str | None = None, scale: float = 1.0, metadata: Any | None = None) Param

Create a free parameter with an associated probability distribution.

Used as the main factory to define parameters for Bayesian inference. Can also be used for bounded optimization, in which case the random variable’s domain (constraint) is used as the bounds.

For built-in distributions, see pmrf.distributions. For built-in constraints, see pmrf.constraints.

Parameters:
  • distribution (AbstractDistribution) – The probability distribution for the parameter.

  • constraint (Optional[AbstractConstraint], optional) – An optional constraint to apply.

  • value (Optional[ArrayLike], optional) – The initial unscaled value. If None, the distribution’s mean is used.

  • fixed (bool, optional) – Initializes the parameter as fixed. Defaults to False.

  • name (str, optional) – A name for the parameter, by default None.

  • scale (float, optional) – The scaling factor to apply, by default 1.0.

  • metadata (Any, optional) – Arbitrary metadata for the parameter, by default None.

Returns:

The random parameter.

Return type:

pmrf.Param

Raises:

ValueError – If value is None and the distribution does not implement mean().