Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Deep Learning avec Python
et Keras et Tensorflow
Voir le programme détaillé
Module « scipy.optimize »

Fonction brent - module scipy.optimize

Signature de la fonction brent

def brent(func, args=(), brack=None, tol=1.48e-08, full_output=0, maxiter=500) 

Description

help(scipy.optimize.brent)

Given a function of one variable and a possible bracket, return
a local minimizer of the function isolated to a fractional precision
of tol.

Parameters
----------
func : callable f(x,*args)
    Objective function.
args : tuple, optional
    Additional arguments (if present).
brack : tuple, optional
    Either a triple ``(xa, xb, xc)`` satisfying ``xa < xb < xc`` and
    ``func(xb) < func(xa) and  func(xb) < func(xc)``, or a pair
    ``(xa, xb)`` to be used as initial points for a downhill bracket search
    (see `scipy.optimize.bracket`).
    The minimizer ``x`` will not necessarily satisfy ``xa <= x <= xb``.
tol : float, optional
    Relative error in solution `xopt` acceptable for convergence.
full_output : bool, optional
    If True, return all output args (xmin, fval, iter,
    funcalls).
maxiter : int, optional
    Maximum number of iterations in solution.

Returns
-------
xmin : ndarray
    Optimum point.
fval : float
    (Optional output) Optimum function value.
iter : int
    (Optional output) Number of iterations.
funcalls : int
    (Optional output) Number of objective function evaluations made.

See also
--------
minimize_scalar: Interface to minimization algorithms for scalar
    univariate functions. See the 'Brent' `method` in particular.

Notes
-----
Uses inverse parabolic interpolation when possible to speed up
convergence of golden section method.

Does not ensure that the minimum lies in the range specified by
`brack`. See `scipy.optimize.fminbound`.

Examples
--------
We illustrate the behaviour of the function when `brack` is of
size 2 and 3 respectively. In the case where `brack` is of the
form ``(xa, xb)``, we can see for the given values, the output does
not necessarily lie in the range ``(xa, xb)``.

>>> def f(x):
...     return (x-1)**2

>>> from scipy import optimize

>>> minimizer = optimize.brent(f, brack=(1, 2))
>>> minimizer
1
>>> res = optimize.brent(f, brack=(-1, 0.5, 2), full_output=True)
>>> xmin, fval, iter, funcalls = res
>>> f(xmin), fval
(0.0, 0.0)



Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les compléments
Voir le programme détaillé