[SciPy-user] fmin stopping on something not a local optimum
Wed Mar 28 09:00:48 CDT 2007
Emin.shopper Martinian.shopper wrote:
> Dear Experts,
> 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 improving.
> 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 success.
> Is one supposed to call fmin repeatedly like this?
I don't think that's how it's supposed to work. This is a bit of a
guess, and I'm not an expert, but I'm sure there'll be someone helpful
reading this to correct my mistakes... :)
What kind of function are you using as "func"? Looking at the fmin
source, the first points it evaluates are the x0 you supply, then it
varies each parameter in turn to +5% of it's current value (or just 0.05
if it starts at zero), to generate the intial simplex. So, if you're
objective function is not very smooth (for example if it's generated by
another iterative procedure with fairly coarse convergence requirements)
it might immediately find itself in a very local minimum that's an
artifact of an imprecise objective function.
On the other hand, if your function is arithmetic and you don't lose
much precision in it I don't suppose this is relevant.
More information about the SciPy-user