[SciPy-user] fmin stopping on something not a local optimum
Wed Mar 28 11:00:41 CDT 2007
On 27/03/07, Emin.shopper Martinian.shopper <email@example.com> wrote:
> Dear Experts,
Well, this isn't addressed to me, but I do use fmin; my objective
function is obtained by numerical integration, but the only real
problem I've had was when it started returning NaNs (numerical
overflows in scipy.stats.chi2.pdf; is there no log-pdf function?).
> I am getting some strange behavior with scipy.optimize.fmin. It seems to
> "converge" to what it thinks is an optimal solution that is not even a local
> optimum. Consequently, I end up having to do things like
> answers = [initialGuess]
> for i in range(5):
> answers.append( scipy.optimize.fmin(func,x0=answers[-1]) )
> In each iteration of the loop, fmin prints information saying it terminated
> successfully (i.e., it is not hitting the maxiter or maxfun constraints
> since I have set these very high) yet the "Current function value" keeps
> Should I be setting the parameters for fmin in a special way to tell it not
> to stop too early? I've tried fiddling with xtol and ftol without much
> Is one supposed to call fmin repeatedly like this?
No. It does have a procedure for deciding when to stop, which can be
fooled. When I was getting NaNs, it signalled error by running to
completion and returning my input guesses, unimproved; the error
handling could be better.
ftol is an absolute tolerance - is your function actually changing on
the scale of ftol? are your x values varying on the scale of xtol?
does your goal function produce values more accurate than ftol? (I
know you said you'd fiddled with them.)
You might look at the code - IIRC it's not some unintelligible FORTRAN
code, it's just python.
More information about the SciPy-user