Skip to content
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

BUG: optimize: ensure line search is not confused by float issues #2864

Merged
merged 1 commit into from Sep 15, 2013

Conversation

pv
Copy link
Member

@pv pv commented Sep 13, 2013

Detect non-finite (nan, inf) results from _cubicmin and _quadmin so that
the rest of the line search doesn't become confused. Avoids problems
when float overflows etc. occur.

Also replace intermediate value checks by exceptions.

Fixes gh-2169

Detect non-finite (nan, inf) results from _cubicmin and _quadmin so that
the rest of the line search doesn't become confused.  Avoids problems
when float overflows etc. occur.

Also replace intermediate value checks by exceptions.
@josef-pkt
Copy link
Member

@pv do you know which other optimizers or rootfinders are using this linesearch, besides bfgs?

@argriffing
Copy link
Contributor

which other optimizers or rootfinders are using this linesearch, besides bfgs?

The ones that use line_search_wolfe2 or _line_search_wolfe12 or optimize.line_search, including at least cg and newton cg. I see that this is implemented from nocedal and wright, which is littered with errata.

@pv
Copy link
Member Author

pv commented Sep 14, 2013

I think the change here is quite safe. The local minimizers either should return None or a finite number. Previously they could also return nan, which confused the zoom algorithm.

@rgommers
Copy link
Member

LGTM. @josef-pkt @argriffing did you still want to look at this?

argriffing added a commit that referenced this pull request Sep 15, 2013
BUG: optimize: ensure line search is not confused by float issues
@argriffing argriffing merged commit f2677c3 into scipy:master Sep 15, 2013
@josef-pkt
Copy link
Member

I don't have any comment about the changes themselves, I don't know this code well enough.
I'm mainly interested in these fixes as a user, keeping track of where we might run into optimization problems in statsmodels, or where the problems disappeared.

@pv
Copy link
Member Author

pv commented Sep 15, 2013

Some problems with e.g. using inf or very large numbers for penalties may disappear due to these changes.

@josef-pkt
Copy link
Member

If my reading is correct, it should also help if the objective function returns nan for some parameter values, doesn't it?

@pv
Copy link
Member Author

pv commented Sep 15, 2013

Yep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants