Package linear_operators :: Package iterative :: Module optimize :: Class FminNCG
[hide private]
[frames] | no frames]

Class FminNCG

source code

 object --+    
          |    
FminWrapper --+
              |
             FminNCG


Abstract class to generate wrappers around scipy.optimize fmin_*
functions.

Parameters
-----------

criterion : Criterion
    A criterion function with __call__ and gradient methods.
x0 : ndarray (None)
    First guess
args=() : tuple
    Extra arguments for the criterion function
kwargs : dict
    Parameters of the fmin_function

fmin function docstring
------------------------
Minimize a function using the Newton-CG method.

Parameters
----------
f : callable f(x,*args)
    Objective function to be minimized.
x0 : ndarray
    Initial guess.
fprime : callable f'(x,*args)
    Gradient of f.
fhess_p : callable fhess_p(x,p,*args)
    Function which computes the Hessian of f times an
    arbitrary vector, p.
fhess : callable fhess(x,*args)
    Function to compute the Hessian matrix of f.
args : tuple
    Extra arguments passed to f, fprime, fhess_p, and fhess
    (the same set of extra arguments is supplied to all of
    these functions).
epsilon : float or ndarray
    If fhess is approximated, use this value for the step size.
callback : callable
    An optional user-supplied function which is called after
    each iteration.  Called as callback(xk), where xk is the
    current parameter vector.

Returns
-------
xopt : ndarray
    Parameters which minimizer f, i.e. ``f(xopt) == fopt``.
fopt : float
    Value of the function at xopt, i.e. ``fopt = f(xopt)``.
fcalls : int
    Number of function calls made.
gcalls : int
    Number of gradient calls made.
hcalls : int
    Number of hessian calls made.
warnflag : int
    Warnings generated by the algorithm.
    1 : Maximum number of iterations exceeded.
allvecs : list
    The result at each iteration, if retall is True (see below).

Other Parameters
----------------
avextol : float
    Convergence is assumed when the average relative error in
    the minimizer falls below this amount.
maxiter : int
    Maximum number of iterations to perform.
full_output : bool
    If True, return the optional outputs.
disp : bool
    If True, print convergence message.
retall : bool
    If True, return a list of results at each iteration.

Notes
-----
Only one of `fhess_p` or `fhess` need to be given.  If `fhess`
is provided, then `fhess_p` will be ignored.  If neither `fhess`
nor `fhess_p` is provided, then the hessian product will be
approximated using finite differences on `fprime`. `fhess_p`
must compute the hessian times an arbitrary vector. If it is not
given, finite-differences on `fprime` are used to compute
it. See Wright & Nocedal, 'Numerical Optimization', 1999,
pg. 140.

Instance Methods [hide private]
 
__call__(self) source code

Inherited from FminWrapper: __init__, first_guess

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __doc__ = FminWrapper.__doc__+ opt.fmin_ncg.__doc__
Properties [hide private]

Inherited from object: __class__