how to stop optimization when using optimize.fmin_l_bfgs_b()
func<< is a function to minimize. Suppose during the optimization process I detect some errors inside >>func<< and want to stop the optimization
In the optimization function scipy.optimize.fmin_l_bfgs_b(func, x0, fprime=None, args=(), approx_grad=0, bounds=None, m=10, factr=10000000.0, pgtol=1.0000000000000001e-05, epsilon=1e-08, iprint=-1, maxfun=15000) process, how should I manoeuvre? Maybe return some random values from
func<<? The same question for >>fprime<<: what should I do to break the optimization process when I realized errors inside fprime?
Thanks! -- Wolfgang Meyer
Assuming you have access to 'func' so that you can modify it, just raise an exception when it detects errors. I think that should stop the optimization immediately. Maybe define your own subtype of exception, or just raise a ValueError, AssertionError or whatever seems most appropriate. On Tue, Nov 11, 2008 at 8:16 PM, Wolfgang Meyer <wolfgang.meyer@gmail.com> wrote:
In the optimization function scipy.optimize.fmin_l_bfgs_b(func, x0, fprime=None, args=(), approx_grad=0, bounds=None, m=10, factr=10000000.0, pgtol=1.0000000000000001e-05, epsilon=1e-08, iprint=-1, maxfun=15000)
func<< is a function to minimize. Suppose during the optimization process I detect some errors inside >>func<< and want to stop the optimization process, how should I manoeuvre? Maybe return some random values from
func<<? The same question for >>fprime<<: what should I do to break the optimization process when I realized errors inside fprime?
Thanks! -- Wolfgang Meyer
participants (2)
-
Rob Clewley
-
Wolfgang Meyer