autofit.GaussianPrior#
- class autofit.GaussianPrior(mean: float, sigma: float, lower_limit: float = -inf, upper_limit: float = inf)[source]#
Bases:
PriorA prior with a uniform distribution, defined between a lower limit and upper limit.
The conversion of an input unit value,
u, to a physical value,p, via the prior is as follows:\[p = \mu + (\sigma * sqrt(2) * erfcinv(2.0 * (1.0 - u))\]For example for
prior = GaussianPrior(mean=1.0, sigma=2.0), an inputprior.value_for(unit=0.5)is equal to 1.0.The mapping is performed using the message functionality, where a message represents the distirubtion of this prior.
- Parameters:
mean – The mean of the Gaussian distribution defining the prior.
sigma – The sigma value of the Gaussian distribution defining the prior.
lower_limit – A lower limit of the Gaussian distribution; physical values below this value are rejected.
upper_limit – A upper limit of the Gaussian distribution; physical values below this value are rejected.
Examples
prior = af.GaussianPrior(mean=1.0, sigma=2.0, lower_limit=0.0, upper_limit=2.0)
physical_value = prior.value_for(unit=0.5)
Methods
assert_within_limitsA dictionary representation of this prior
for_class_and_attribute_namefrom_dictReturns a prior from a JSON representation.
gaussian_prior_model_for_argumentshasDoes this instance have an attribute which is of type cls?
instance_for_argumentsmake_indexesname_of_classA string name for the class, with the prior suffix removed.
newReturns a copy of this prior with a new id assigned making it distinct
next_idprojectrandomA random value sampled from this prior
replacing_for_pathCreate a new model replacing the value for a given path with a new value
unit_value_forCompute the unit value between 0 and 1 for the physical value.
value_forReturn a physical value for a value between 0 and 1 with the transformation described by this prior.
Create a new gaussian prior centred between two limits with sigma distance between this limits.
with_messageAttributes
component_numberfactorA callable PDF used as a factor in factor graphs
identifierlabellimitslower_unit_limitThe lower limit for this prior in unit vector space
ndimHow many dimensions does this variable have?
parameter_stringupper_unit_limitThe upper limit for this prior in unit vector space
width- classmethod with_limits(lower_limit: float, upper_limit: float) GaussianPrior[source]#
Create a new gaussian prior centred between two limits with sigma distance between this limits.
Note that these limits are not strict so exceptions will not be raised for values outside of the limits.
This function is typically used in prior passing, where the result of a model-fit are used to create new Gaussian priors centred on the previously estimated median PDF model.
- Parameters:
lower_limit – The lower limit of the new Gaussian prior.
upper_limit – The upper limit of the new Gaussian Prior.
- Return type:
A new GaussianPrior