autofit.UniformPrior#
- class autofit.UniformPrior(lower_limit: float = 0.0, upper_limit: float = 1.0, id_=None)[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:\[\]For example for
prior = UniformPrior(lower_limit=0.0, upper_limit=2.0), an inputprior.value_for(unit=0.5)is equal to 1.0.[Rich describe how this is done via message]
- Parameters:
lower_limit – The lower limit of the uniform distribution defining the prior.
upper_limit – The upper limit of the uniform distribution defining the prior.
Examples
prior = af.UniformPrior(lower_limit=0.0, upper_limit=2.0)
physical_value = prior.value_for(unit=0.2)
Methods
assert_within_limitsdictA 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_argumentsReturns the log prior of a physical value, so the log likelihood of a model evaluation can be converted to a posterior as log_prior + log_likelihood.
logpdfmake_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.
Returns a physical value from an input unit value according to the limits of the uniform prior.
with_limitsCreate a new instance of the same prior class with the passed 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- value_for(unit: float, ignore_prior_limits: bool = False) float[source]#
Returns a physical value from an input unit value according to the limits of the uniform prior.
- Parameters:
unit – A unit value between 0 and 1.
- Returns:
The unit value mapped to a physical value according to the prior.
- Return type:
value
Examples
prior = af.UniformPrior(lower_limit=0.0, upper_limit=2.0)
physical_value = prior.value_for(unit=0.2)
- static log_prior_from_value(value)[source]#
Returns the log prior of a physical value, so the log likelihood of a model evaluation can be converted to a posterior as log_prior + log_likelihood.
This is used by certain non-linear searches (e.g. Emcee) in the log likelihood function evaluation.
For a UniformPrior this is always zero, provided the value is between the lower and upper limit.