autofit.LogGaussianPrior#
- class LogGaussianPrior[source]#
Bases:
PriorA prior for a variable whose logarithm is gaussian distributed. Work in natural log.
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 = LogGaussianPrior(mean=1.0, sigma=2.0), an inputprior.value_for(unit=0.5)is equal to 1.0.[Rich describe how this is done via message]
- Parameters:
Examples
prior = af.LogGaussianPrior(mean=1.0, sigma=2.0)
physical_value = prior.value_for(unit=0.5)
Methods
dictA dictionary representation of this prior
for_class_and_attribute_nameCreate a prior from the configuration for a given class and attribute.
from_dictReturns a prior from a JSON representation.
gaussian_prior_model_for_argumentsLook up this prior in an arguments dict and return the mapped value.
hasDoes this instance have an attribute which is of type cls?
instance_for_argumentsLook up this prior's value in an arguments dictionary.
make_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_idprojectProject this prior given samples and log weights from a search.
randomA random value sampled from this prior
replacing_for_pathCreate a new model replacing the value for a given path with a new value
tree_unflattenCreate a prior from a flattened PyTree
unit_value_forCompute the unit value between 0 and 1 for the physical value.
Return 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_messageReturn a copy of this prior with a different message (distribution).
Attributes
component_numberfactorA callable PDF used as a factor in factor graphs
identifierlabellimitsThe (lower, upper) bounds of this prior.
namendimHow many dimensions does this variable have?
A human-readable string summarizing this prior's parameters.
- classmethod with_limits(lower_limit, upper_limit)[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.
- value_for(unit)[source]#
Return a physical value for a value between 0 and 1 with the transformation described by this prior.
- Parameters:
unit (
float) – A unit value between 0 and 1.- Return type:
A physical value, mapped from the unit value accoridng to the prior.