[SciPy-User] Minimization of a function that can return nan

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[SciPy-User] Minimization of a function that can return nan

federico vaggi-2
Hi everyone,

I'm using fmin_l_bfgs_b to find the best fit parameters for a system of ordinary differential equations.  Since the system has multiple local minima, I found that it's very convenient to divide the parameter space in hypercubes, and perform multiple local minimizations.

Occasionally, for certain regions of the parameter space, the numerical integration routine fails.  What's the correct way to handle this gracefully?  Capture the exception, and return inf as the cost function value, and set the gradient to equal to all nan?


SciPy-User mailing list
[hidden email]