inversion_ideas.conditions.ObjectiveChanged#
- class inversion_ideas.conditions.ObjectiveChanged(objective_function, rtol=0.001, atol=0.0)[source]#
Stopping criterion for when an objective function didn’t changed above a tolerance.
- Parameters:
- objective_function
base.Objective Objective function that will be evaluated.
- rtol
float, optional Relative tolerance below which the model will be considered of not changing enough.
- atol
float, optional Absolute tolerance below which the model will be considered of not changing enough.
- objective_function
Methods
__call__(model)Evaluate the condition on a given model.
info(model)Display information about the condition for a given model.
Initialize condition and clean
previousattribute.ratio(model)Ratio
|φ(m) - φ(m_prev)|/|φ(m_prev)|.update(model)Cache value of objective function with model as the
previousone.Notes
The stopping criterion evaluates:
\[\frac{ | \phi(\mathbf{m}) - \phi(\mathbf{m}_\text{old}) | }{ | \phi(\mathbf{m}_\text{old}) | } \le \delta_r,\]and
\[| \phi(\mathbf{m}) - \phi(\mathbf{m}_\text{old}) | \le \delta_a,\]where \(\phi\), is the objective function, \(\mathbf{m}\) is the current model, \(\mathbf{m}_\text{old}\) is the previous model in the inversion, and \(\delta_r\) and \(\delta_a\) are the relative and absolute tolerances whose values are given by
rtolandatol, respectively.When called, if any of those inequalities hold, the stopping criterion will return
True, andFalseotherwise.
Methods#
Methods documentation
- ObjectiveChanged.info(model)[source]#
Display information about the condition for a given model.
- Parameters:
- model(n_params,)
array Array with model values.
- model(n_params,)
- Returns:
rich.tree.Treerick.tree.Treeobject containing information about the condition.
- ObjectiveChanged.update(model)[source]#
Cache value of objective function with model as the
previousone.