New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimize.minimize infinite loop with Newton-CG #6165
Comments
Example reproduces for me. The IIRC we decided quite a while ago to never have such |
Thanks @rgommers! One fix for this is to evaluate whether xsupi changes after the adjustment and if not, break out. That works for me locally, but I wasn't sure if that was too much of a hack versus a more proper way to address this |
The safest fix is probably to add maxiter. I'm not sure what the curvature termination condition for the algorithm exactly is, so unless this is made clear, the algorithm should terminate with failure in this case. |
gh-6229 adds a (mechanical) fix: it simply caps the number of iterations in this inner loop. |
Thanks for addressing this @ev-br |
@Chris7 I hesitated to convert your gist into a test. If you can contribute a test (ideally, something smaller), that would be very welcome. |
The test would be a function that doesn't converge -- so I guess you can use anything without a minimum? The hessian I posted was actually wrong, and this helped me track it down. Though the behavior with this curvature wasn't desired (it just kept iterating vs halting) |
I am currently trying to use Newton-CG but am running into a problem where I encounter an infinite loop in the minimization routine. Code to replicate this may be found here:
https://gist.github.com/Chris7/51ed3a8f8cec011ce3342615675195b7
I am using Ubuntu 14.04 64 bit, and here is my pip freeze:
The code which runs infinitely is in optimize.optimize, lines 1412-1440 and are:
I would try to patch this myself, but I do not know enough about the Newton-CG method (yet). The issue appears to be that xsupi never increments and the curvature keeps increasing so it never breaks.
The text was updated successfully, but these errors were encountered: