autofit.LogUniformPrior#
- class LogUniformPrior[source]#
Bases:
Prior
A prior with a log base 10 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 = LogUniformPrior(lower_limit=10.0, upper_limit=1000.0)
, an inputprior.value_for(unit=0.5)
is equal to 100.0.[Rich describe how this is done via message]
- Parameters:
Examples
prior = af.LogUniformPrior(lower_limit=0.0, upper_limit=2.0)
physical_value = prior.value_for(unit=0.2)
Methods
assert_within_limits
dict
A dictionary representation of this prior
for_class_and_attribute_name
from_dict
Returns a prior from a JSON representation.
gaussian_prior_model_for_arguments
has
Does this instance have an attribute which is of type cls?
instance_for_arguments
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.
make_indexes
name_of_class
A string name for the class, with the prior suffix removed.
new
Returns a copy of this prior with a new id assigned making it distinct
next_id
project
random
A random value sampled from this prior
replacing_for_path
Create a new model replacing the value for a given path with a new value
tree_unflatten
Create a prior from a flattened PyTree
unit_value_for
Compute 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 log10 uniform prior.
Create a new log 10 uniform prior centred between two limits with sigma distance between this limits.
with_message
Attributes
component_number
factor
A callable PDF used as a factor in factor graphs
identifier
label
limits
lower_unit_limit
The lower limit for this prior in unit vector space
ndim
How many dimensions does this variable have?
parameter_string
upper_unit_limit
The upper limit for this prior in unit vector space
width
- classmethod with_limits(lower_limit, upper_limit)[source]#
Create a new log 10 uniform 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.
- 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.
- value_for(unit, ignore_prior_limits=False)[source]#
Returns a physical value from an input unit value according to the limits of the log10 uniform prior.
- Parameters:
unit (
float
) – 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.LogUniformPrior(lower_limit=0.0, upper_limit=2.0)
physical_value = prior.value_for(unit=0.2)