bundles / scipy latest / scipy / optimize / _optimize / fmin
function
scipy.optimize._optimize:fmin
Signature
def fmin ( func , x0 , args = () , xtol = 0.0001 , ftol = 0.0001 , maxiter = None , maxfun = None , full_output = 0 , disp = 1 , retall = 0 , callback = None , initial_simplex = None ) Summary
Minimize a function using the downhill simplex algorithm.
Extended Summary
This algorithm only uses function values, not derivatives or second derivatives.
Parameters
func: callable func(x,*args)The objective function to be minimized.
x0: ndarrayInitial guess.
args: tuple, optionalExtra arguments passed to func, i.e.,
f(x,*args).xtol: float, optionalAbsolute error in xopt between iterations that is acceptable for convergence.
ftol: number, optionalAbsolute error in func(xopt) between iterations that is acceptable for convergence.
maxiter: int, optionalMaximum number of iterations to perform.
maxfun: number, optionalMaximum number of function evaluations to make.
full_output: bool, optionalSet to True if fopt and warnflag outputs are desired.
disp: bool, optionalSet to True to print convergence messages.
retall: bool, optionalSet to True to return list of solutions at each iteration.
callback: callable, optionalCalled after each iteration, as callback(xk), where xk is the current parameter vector.
initial_simplex: array_like of shape (N + 1, N), optionalInitial simplex. If given, overrides
x0.initial_simplex[j,:]should contain the coordinates of the jth vertex of theN+1vertices in the simplex, whereNis the dimension.
Returns
xopt: ndarrayParameter that minimizes function.
fopt: floatValue of function at minimum:
fopt = func(xopt).iter: intNumber of iterations performed.
funcalls: intNumber of function calls made.
warnflag: int1Maximum number of function evaluations made. 2 : Maximum number of iterations reached.
allvecs: listSolution at each iteration.
Notes
Uses a Nelder-Mead simplex algorithm to find the minimum of function of one or more variables.
This algorithm has a long history of successful use in applications. But it will usually be slower than an algorithm that uses first or second derivative information. In practice, it can have poor performance in high-dimensional problems and is not robust to minimizing complicated functions. Additionally, there currently is no complete theory describing when the algorithm will successfully converge to the minimum, or how fast it will if it does. Both the ftol and xtol criteria must be met for convergence.
Examples
def f(x): return x**2✓
from scipy import optimize
✓minimum = optimize.fmin(f, 1)
✓minimum[0]
✗See also
- minimize
Interface to minimization algorithms for multivariate functions. See the 'Nelder-Mead'
methodin particular.
Aliases
-
scipy.optimize.fmin