-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
errors in fmin_bfgs and some improvements (Trac #734) #1261
Comments
Attachment added by trac user jgarcke on 2008-09-03: optimize.py.diff |
Milestone changed to |
trac user jgarcke wrote on 2010-11-11 parts of this appearing here (and were fixed) |
@rgommers wrote on 2010-11-13 The parts that are still relevant are here: rgommers@c5b0f4af. The change to compute sk is straightforward. The change in handling div-by-zero looks fine too. Two questions for the extra stopping criterion:
|
trac user jgarcke wrote on 2010-11-15 I took 1e-6 since it is the default option here: default value : opts(1:6) = [2 2 1 1e-4*||g(x0)||_inf 1e-6 100] But then, it probably should be an option in the function call with the default set to 1e-6. Test as in a numerical example that this works ? And works better with this change ? Not really, I had problems with this inside a programm I had and didn't go down to a simple example because there it often enough works in the current form. And I can't easily extract the part where the minimisation happens since it depends on the whole part of the software. And I later used a different algorithm anyway: ALGORITHM 611, COLLECTED ALGORITHMS FROM ACM. where I used f2py and a wrapper routine in python. That one was more robust and faster than the python one. If interested I can give my python wrapper for that one. |
Attachment added by @rgommers on 2010-11-28: ticket-734.patch |
@nilswagner01 wrote on 2011-04-13
|
Attachment added by trac user rfc on 2011-05-07: ticket-734-tweaks.patch |
trac user rfc wrote on 2011-05-07 Hello all, I suggest a few small changes to rgommers' patch (see above patch):
Changes 2. and 3. follow the advice from the notes on Unconstrained Optimization located here: http://www2.imm.dtu.dk/documents/ftp/publlec.html On a related note, I think the scalar_search_wolfe1 function from linesearch could use a bit of work. A more rugged line search would further improve the robustness of fmin_bfgs and fmin_cg. This function wraps minpack's dcsrch routine but I think scalar_search_wolfe1 could be improved to avoid calling dcsrch with invalid inputs. Another possible change could be to raise errors when dcsrch fails (containing the detailed error message from dcsrch, for example) instead of hiding the errors and returning None. I'd like to submit a patch for this when I can find the time. |
@rgommers wrote on 2011-05-09 That all sounds reasonable. J. Garcke (who supplied the original patch, I just updated it) and you are working from the same reference it seems. @jgarcke: could you review the proposed changes? It would be good to wrap this up. Improvements to scalar_search_wolfe1 are also very welcome. |
Milestone changed to |
trac user jgarcke wrote on 2011-05-10 The latest patch looks good. Thanks. |
@rgommers wrote on 2011-06-04 @rfc: I made one small change to your patch, see https://github.com/rgommers/scipy/tree/ticket-734-fmin_bfg. A new keyword argument (xtol) should always be added at the end. Otherwise it breaks backwards compatibility when keyword args are supplied as positional args. The xtol addition should have a test that exercises it. Do you have an example that can be turned into a test? |
@rgommers wrote on 2011-08-27 Sorry, that link is broken, should be https://github.com/rgommers/scipy/tree/ticket-734-fmin_bfgs. |
Milestone changed to |
@pv wrote on 2012-05-19 According to Wright & Nocedal (p. 201), skipping the update is not so good, and a better alternative is to use a damped BFGS update (p. 538). They don't give a direct formula for the update for H, so one needs a think a little bit here first. The |
This link still works: master...rgommers:ticket-734-fmin_bfgs I can't remember the details, so no opinion on whether that's still applicable. |
The xtol part of the change is still valid and useful. And likely it could still be interesting to look at the above algorithm 611 and bind that into scipy. But I have no idea about the process involved for that. |
Going through old issues to attempt to summarize and evaluate next steps to possibly close them, please let me know if anyone has suggestions on other things I need to consider :) Original Issue:
Summary of above discussion:
Outstanding Items:
Suggestion:Decided whether or not the update to
Let me know if anyone has suggestions! |
@WillTirone thanks for that summary. Could you submit a PR that merges this commit into main (even though that may mean ignoring git's automatic attempt to merge and manually applying the relevant changes to resolve the merge conflict)? Then we can review it like normal. We may or may not decide not to change the way |
@mdhaber sure! I'll take a look at my summary and try what you suggested above, it may take a week or two. |
(update that I'm still working on this, in my first semester of grad school so quite busy, but hopefully can get closed for closember) |
Original ticket http://projects.scipy.org/scipy/ticket/734 on 2008-09-03 by trac user jgarcke, assigned to @cournape.
There are a couple of issues with fmin_bfgs in optimize.py.
I'll attach a patch against optimize.py from Revision 4683, but that file / fmin_bfgs hasn't really changed much anyway recently.
The following are changes to achieve a more robust behaviour
The text was updated successfully, but these errors were encountered: