inversion_ideas.GaussNewtonConjugateGradient#
- class inversion_ideas.GaussNewtonConjugateGradient(*, maxiter=100, maxiter_line_search=10, rtol=1e-05, stopping_criterion=None, cg_kwargs=None)#
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.
- Parameters:
- maxiterint, optional
Maximum number of Gauss-Newton iterations.
- maxiter_line_searchint, optional
Maximum number of line search iterations.
- rtolfloat, 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_criterionCondition, Callable or None, 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_kwargsdict or None, optional
Dictionary with extra arguments passed to the
scipy.sparse.linalg.cg()function.
Methods
Methods#
Methods documentation
- GaussNewtonConjugateGradient.__call__(objective, initial_model, *, preconditioner=None, callback=None)#
Create iterator over Gauss-Newton minimization.
- Parameters:
- objectiveObjective
Objective function to be minimized.
- initial_model(n_params) array
Initial model used to start the minimization.
- preconditioner(n_params, n_params) array, sparse array or LinearOperator, 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.- callbackcallable, optional
Callable that gets called after each iteration.
- GaussNewtonConjugateGradient.run(objective, initial_model, *args, **kwargs)#
Run all iterations of the minimizer at once.
- Parameters:
- objectiveObjective
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.
- Returns:
- inverted_model(n_params) array
Final inverted model.