[SciPy-Dev] step size for optimize nelder-mead
InSuk Joung
i.joung at gmail.com
Thu May 8 22:01:21 EDT 2014
Hello developers,
I like to suggest adding an initial step size for nelder-mead optimization
as an option.
A suggested patch is pasted below:
diff --git a/scipy/optimize/optimize.py b/scipy/optimize/optimize.py
index 9b4ad6d..386a416 100644
--- a/scipy/optimize/optimize.py
+++ b/scipy/optimize/optimize.py
@@ -316,6 +316,8 @@ def fmin(func, x0, args=(), xtol=1e-4, ftol=1e-4,
maxiter=None, maxfun=None,
Set to True to print convergence messages.
retall : bool, optional
Set to True to return list of solutions at each iteration.
+ step : ndarray, optional
+ Initial step size.
Returns
-------
@@ -368,7 +370,8 @@ def fmin(func, x0, args=(), xtol=1e-4, ftol=1e-4,
maxiter=None, maxfun=None,
'maxiter': maxiter,
'maxfev': maxfun,
'disp': disp,
- 'return_all': retall}
+ 'return_all': retall,
+ 'step': step}
res = _minimize_neldermead(func, x0, args, callback=callback, **opts)
if full_output:
@@ -385,7 +388,7 @@ def fmin(func, x0, args=(), xtol=1e-4, ftol=1e-4,
maxiter=None, maxfun=None,
def _minimize_neldermead(func, x0, args=(), callback=None,
xtol=1e-4, ftol=1e-4, maxiter=None, maxfev=None,
- disp=False, return_all=False,
+ disp=False, return_all=False, step=None,
**unknown_options):
"""
Minimization of scalar function of one or more variables using the
@@ -440,7 +443,9 @@ def _minimize_neldermead(func, x0, args=(),
callback=None,
zdelt = 0.00025
for k in range(0, N):
y = numpy.array(x0, copy=True)
- if y[k] != 0:
+ if step[k]:
+ y[k] += step[k]
+ elif y[k] != 0:
y[k] = (1 + nonzdelt)*y[k]
else:
y[k] = zdelt
@@ -2609,6 +2614,8 @@ def show_options(solver=None, method=None):
Relative error in ``fun(xopt)`` acceptable for convergence.
maxfev : int
Maximum number of function evaluations to make.
+ step : ndarray
+ Initial step size.
*Newton-CG* options:
--
Best,
InSuk Joung
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20140509/b709fca4/attachment.html>
More information about the SciPy-Dev
mailing list