uravu.optimize¶
The optimize module includes the functionality necessary for maximum likelihood determination.
Furthermore, the natural log likelihood function used in the mcmc()
and nested_sampling()
methods may be found here.
-
uravu.optimize.
ln_likelihood
(variables: numpy.ndarray, function: Callable, abscissa: numpy.ndarray, ordinate: numpy.ndarray) → float[source]¶ Calculate the natural logarithm of the likelihood given a set of variables, when there is no uncertainty in the abscissa.
Parameters: - variables – Variables for the function evaluation.
- function – The function to be evaluated.
- abscissa – The abscissa values.
- ordinate – The ordinate values.
Returns: Natural log-likelihood between model and data.
-
uravu.optimize.
max_ln_likelihood
(relationship: uravu.relationship.Relationship, method: str, x0: numpy.ndarray = None, **kwargs) → numpy.ndarray[source]¶ Determine the variable values which maximize the likelihood for the given relationship. For keyword arguments see the
scipy.optimize.minimize()
documentation.Parameters: - relationship – The relationship for which variables should be found.
- method – Method for optimisation to be used.
- x0 – Initial guesses for the variable values. Default to the current
variables
values which are initialized as all1
.
Returns: Optimized variables for the relationship.
-
uravu.optimize.
negative_lnl
(variables: numpy.ndarray, function: Callable, abscissa: numpy.ndarray, ordinate: numpy.ndarray) → float[source]¶ Calculate the negative natural logarithm of the likelihood given a set of variables, when there is no uncertainty in the abscissa.
Parameters: - variables – Variables for the function evaluation.
- function – The function to be evaluated.
- abscissa – The abscissa values.
- ordinate – The ordinate values.
Returns: Negative natural log-likelihood between model and data.