inversion_ideas.conditions.ObjectiveChanged#

class inversion_ideas.conditions.ObjectiveChanged(objective_function, rtol=0.001, atol=0.0)#

Stopping criterion for when an objective function didn’t changed above a tolerance.

Parameters:
objective_functionObjective

Objective function that will be evaluated.

rtolfloat, optional

Relative tolerance below which the model will be considered of not changing enough.

atolfloat, optional

Absolute tolerance below which the model will be considered of not changing enough.

Methods

__call__(model)

Evaluate the condition on a given model.

info(model)

Display information about the condition for a given model.

initialize()

Initialize condition and clean previous attribute.

ratio(model)

Ratio |φ(m) - φ(m_prev)|/|φ(m_prev)|.

update(model)

Cache value of objective function with model as the previous one.

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 rtol and atol, respectively.

When called, if any of those inequalities hold, the stopping criterion will return True, and False otherwise.

Methods#

Methods documentation

ObjectiveChanged.__call__(model)#

Evaluate the condition on a given model.

Parameters:
model(n_params) array

Array with model values.

Returns:
bool

Whether the condition is True or False.


ObjectiveChanged.info(model)#

Display information about the condition for a given model.

Parameters:
model(n_params) array

Array with model values.

Returns:
rich.tree.Tree

rick.tree.Tree object containing information about the condition.


ObjectiveChanged.initialize()#

Initialize condition and clean previous attribute.


ObjectiveChanged.ratio(model)#

Ratio |φ(m) - φ(m_prev)|/|φ(m_prev)|.


ObjectiveChanged.update(model)#

Cache value of objective function with model as the previous one.