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 | None = None, 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.stats.distributions. For built-in constraints, seepmrf.parameters.constraints.- Parameters:
distribution (AbstractDistribution) – The probability distribution for the parameter.
constraint (Optional[AbstractConstraint], optional) – An optional range. The distribution is truncated to it and renormalised.
value (Optional[ArrayLike], optional) – The initial declared 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 units the value is written in. None, the default, inherits the scale of the field the parameter is passed to, or acts as 1.0.
metadata (Any, optional) – Arbitrary metadata for the parameter, by default None.
- Returns:
The random parameter.
- Return type:
- Raises:
ValueError – If value is None and the distribution does not implement mean(), or the distribution reaches outside constraint and cannot be truncated to it.