inversion_ideas.minimize.GaussNewtonConjugateGradient#
- class inversion_ideas.minimize.GaussNewtonConjugateGradient(*, maxiter=100, rtol=1e-05, stopping_criterion=None, cg_rtol=1e-05, cg_atol=0.0, cg_kwargs=None, line_search_maxiter=10, line_search_kwargs=None)[source]#
Minimize non-linear objective functions using a Gauss-Newton Conjugate Gradient.
Apply Gauss-Newton iterations using a Conjugate Gradient to find search directions, and use a backtracking line search to update the model after each iteration. The conjugate gradient algorithm is applied through the
scipy.sparse.linalg.cg()function, and the backtracking line search throughbacktracking_line_search().- Parameters:
- maxiter
int, optional Maximum number of Gauss-Newton iterations.
- rtol
float, optional Relative tolerance for the objective function. If the relative difference between the current and previous value of the objective function is below
rtol, then the minimization is considered as converged.- stopping_criterion
base.Condition,callable()orNone, optional Additional stopping condition that will make the Gauss-Newton iterations to finish. When a condition is passed, the Gauss-Newton iterations will finish if the condition is met, the Gauss-Newton converges (relative difference below
rtol), or if maximum number of iterations are reached. If None, Gauss-Newton iterations will finish if convergence or maximum number of iterations are reached.- cg_rtol
float, optional Relative tolerance for the conjugate gradient algorithm. This value will be passed to the
scipy.sparse.linalg.cg()through thertolargument.- cg_atol
float, optional Absolute tolerance for the conjugate gradient algorithm. This value will be passed to the
scipy.sparse.linalg.cg()through theatolargument.- cg_kwargs
dictorNone, optional Dictionary with extra arguments passed to the
scipy.sparse.linalg.cg()function.Hint
Don’t include
"rtol"or"atol"in this dictionary. Pass them directly through thecg_rtolandcg_atolarguments.- line_search_maxiter
int, optional Maximum number of line search iterations.
- line_search_kwargs
dictorNone, optional Dictionary with extra arguments passed to the
backtracking_line_search()function.Hint
Don’t include
"maxiter"in this dictionary. Pass it directly through theline_search_maxiterarguments.
- maxiter
Methods
Methods#
Methods documentation
- GaussNewtonConjugateGradient.__call__(objective, initial_model, *, preconditioner=None, callback=None)[source]#
Create iterator over Gauss-Newton minimization.
- Parameters:
- objective
base.Objective Objective function to be minimized.
- initial_model(n_params,)
array Initial model used to start the minimization.
- preconditioner(n_params, n_params)
array,sparsearrayorLinearOperator, optional Matrix used as preconditioner in the conjugate gradient algorithm. If None, no preconditioner will be used. If the preconditioner implements an
updatemethod, the preconditioner will be updated before every conjugate gradient minimization.- callback
callable(), optional Callable that gets called after each iteration.
- objective
- GaussNewtonConjugateGradient.run(objective, initial_model, *args, **kwargs)[source]#
Run all iterations of the minimizer at once.
- Parameters:
- objective
base.Objective Objective function to be minimized.
- initial_model(n_params,)
array Initial model used to start the minimization.
- *args
Any extra positional argument will be passed to the
__call__method.- *kwargs
Any extra keyword argument will be passed to the
__call__method.
- objective
- Returns:
- inverted_model(n_params,)
array Final inverted model.
- inverted_model(n_params,)