Giter Club home page Giter Club logo

linesearches.jl's People

Contributors

andygreenwell avatar anriseth avatar antoine-levitt avatar benkuhn avatar chriselrod avatar chrisrackauckas avatar cortner avatar dankolbman avatar femtocleaner[bot] avatar johnmyleswhite avatar juliatagbot avatar kristofferc avatar mateuszbaran avatar mlubin avatar mohamed82008 avatar pkofod avatar staticfloat avatar timholy avatar yuyichao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

linesearches.jl's Issues

Do we need LineSearchResults?

Optim doesn't really use LineSearchResults for much, and neither does LineSearches. Maybe we should just get rid of it?

One con that I can think of.

  1. LineSearchResults works sort-of like the store_trace does in Optim, and may be valuable (if we bother using it)

If we move on with this remake, we should also fully embrace value_gradient! etc. from NLSolversBase. This must somehow be done in conjunction with a way to communicate the slope of the function \phi(\alpha) = f(x + \alpha * s), which now is calculated using vecdot(s, gradient(f)). So maybe this is the time to fully move onwards and redefine to work with phi(\alpha) instead of f and gradient(f)?

Documentation?

We should create documentation, or at the very least explain the input and output structure for the linesearch algorithms.

Move some removed tests

  • Counter: Find a situation where all the (non-trivial) linesearches require at least two evals (e.g. Himmelblau above?)
  • Optim usage: This should be covered by the "other package", and not in LineSearches.

from #59

Wrong object returned in _hzI12

        if iterfinite >= iterfinitemax
            return T(0), true
            #             error("Failed to achieve finite test value; alphatest = ", alphatest)
        end

at initialguess.jl:234 returns Float64, Bool, where it should return Float64. Not sure what the right fix is here, so passing it to @pkofod ;-)

Remove deprecations

Deprecations on types and g-storage were introduced in LineSearches v2. We're now on v3, so it's time to remove them.

Error precompiling master `"<<" is not a unary operator`

julia> using LineSearches
INFO: Precompiling module LineSearches.
ERROR: LoadError: LoadError: syntax: "<<" is not a unary operator
Stacktrace:
 [1] include_from_node1(::String) at .\loading.jl:576
 [2] include(::String) at .\sysimg.jl:14
 [3] include_from_node1(::String) at .\loading.jl:576
 [4] include(::String) at .\sysimg.jl:14
 [5] anonymous at .\<missing>:2
while loading C:\Users\user\.julia\v0.6\LineSearches\src\hagerzhang.jl, in expression starting on line 449
while loading C:\Users\user\.julia\v0.6\LineSearches\src\LineSearches.jl, in expression starting on line 104
ERROR: Failed to precompile LineSearches to C:\Users\user\.julia\lib\v0.6\LineSearches.ji.
Stacktrace:
 [1] compilecache(::String) at .\loading.jl:710
 [2] _require(::Symbol) at .\loading.jl:497
 [3] require(::Symbol) at .\loading.jl:405

More tests

  • Test linesearch behaviour when alpha = NaN, Inf or negative
  • Add counter tests (we can create OnceDifferentiable objects using NLSolversBase)

Non-descent directions

In HagerZhang and MoreThuente we throw errors if the step direction is not a descent direction (that is, d\phi(0) \geq 0).

No tests are made in BackTracking and StrongWolfe, and it seems like they just return the given step length. I think the algorithms assume a descent direction, so we should probably be consistent here and throw an error.

I think we should leave Static alone, as my intention with it is for more "advanced" optimizers to decide exactly what the step should be (as long as it produces finite function values).

Ref: #91

Incompatible arguments

If I try to use LineSearches.hz_linesearch! instead of Optim.hz_linesearch! then I get the following error:

LoadError: MethodError: no method matching hz_linesearch!(::Optim.DifferentiableFunction, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Optim.LineSearchResults{Float64}, ::Float64, ::Bool)
Closest candidates are:
  hz_linesearch!{T}(!Matched::LineSearches.AbstractDifferentiableFunction, ::Array{T,N}, ::Array{T,N}, ::Array{T,N}, ::Array{T,N}, !Matched::LineSearches.LineSearchResults{T}, ::Real, ::Bool) at /Users/ortner/.julia/v0.5/LineSearches/src/hz_linesearch.jl:75

Is there maybe a specific branch of Optim that I should use?

Step by step linesearch

Hi,

Sorry to create another issue with an easy question, but I was wondering if there is a way to display each iteration of a line search algorithm.

The basic example on show the results but I'd like to see every step of the process.

Thank you very much!

Unnecessary call to `log2`?

Hey, I'm the author of MultiFloats.jl, a new Julia package for extended precision arithmetic. I'd like to make my MultiFloat{T,N} type compatible with Optim.jl, but unfortunately I don't have an implementation of log2(::MultiFloat) yet, which trips up this one line in hagerzhang.jl:

iterfinitemax::Int = ceil(Int, -log2(eps(T)))

Is there any reason that this couldn't be replaced with precision(T)-1 or -exponent(eps(T)), to allow floating-point types that don't have log2 implemented? Of course I'm also working on implementing transcendental functions in MultiFloat.jl, but for the simple task of getting the exponent of epsilon, I figure a call to a transcendental function is unnecessary anyway.

Communicate f-value back to caller?

The linesearches communicates the step length back to the caller, but not the objective value.
We should pass the objective value back as well to stop unnecessary calls of the objective function in Optim and NLOpt NLSolve

Simple example doesn't work

Hi,

I am trying to do the simple example provided, but it doesn't work.

using Optim
using LineSearches
prob = Optim.UnconstrainedProblems.examples["Rosenbrock"]

all works fine but when I do
algo_hz = Newton(linesearch = hagerzhang!)

I get the following error:
WARNING: both LineSearches and Optim export "hagerzhang!"; uses of it in module Main must be qualified
ERROR: UndefVarError: hagerzhang! not defined

Why is that?

Thanks for your help!

Add logging functionality

I'd like to see a flexible logging / tracing functionality here.

Currently there is little info provided when things go wrong inside the linesearches. Finiteness tests such as #101 should (optionally) warn the user that something is wrong.

TODO: New LineSearches

ref changes in #80

  • Don't allocate vectors. We might as well have them as scalars to avoid allocations
  • We should also free the deepest layer of df, although we could in theory still provide simple wrappers.
  • Add an argument to specify a largest \alpha. This is to accommodate Fminbox and other simple constrained optimizers not evaluating outside of constraints. Of course, some constrained optimizers will need more specialized line searches (or use trust regions of course).
  • We should return \alpha, \phi(\alpha) to avoid recalculation of \phi if packages other than Optim and NLsolve want to use these functions. We can still call value_gradient! outside, as we're checking if it's the same point anyway.
    ... more?

Support DoubleFloats

Currently these don't work together with the Inf values in our @with_kw structs.

This can be fixed with JuliaMath/DoubleFloats.jl#18, and if so we should re-enable the DoubleFloats tests in arbitrary_precision.jl. Otherwise, we'll have to think of something new here

LineSearchOptions

At the moment all linesearchoptions (e.g. C1, C2) are passed via arguments. This makes it a bit of a pain for the user to set those arguments given how the line search functions are passed to Optim. I suggest to either move to a LineSearchOptions type or to keyword arguments.

Function Names

I suggest to replace hz_linesearch! by hagerzhang!, mt_linesearch! by morethuente!, backtracking_linesearch!bybacktrackingand so forth. Then they could be called viaLineSearches.backtracking!`, etc.

Concerns about Hager Zhang initialization

I have a few questions/concerns about the initialization of HagerZhang:

  1. If we start at or close to the minimizer, dphi0 will be close to 0, so it is possible this will error
    if alpha == 0
    .
  2. In the paper, the quadratic stepping is optional and when it fails, the algorithm falls back on using an initial guess that is a multiple of the previous step size. Isn't this a more reasonable thing to do rather than error above?
  3. If I understand correctly, this line
    if phitest > phi_0
    is not in the original paper.
  4. While I understand the rationale behind the while loop in
    while !isfinite(phitest)
    which was used to ensure that phitest is finite, possibly a concern with log-barrier methods, but this guarantee is gone in . Maybe do a similar loop here?

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Implement backtracking with cubic interpolation

We should redo the backtracking algorithm, and let the user choose between quadratic and cubic interpolation.

The "standard" case with no interpolation does not work very well, so I say we scrap that.

Follow "Numerical Optimization" by Nocedal and Wright, page 56, and/or
"Numerical Methods for Unconstrained Optimization and Nonlinear Equations" by Dennis and Schnabel, page 325.

Create functionality for alphaguess

  • Move alphaguess from Optim.
  • Make it a type chosen by the user.
  • Default all of them to alpha = 1 (Optim change. Except Accelerated and Momentum GD)

Initial ones to implement:

  • Set alpha = 1
  • Keep the previous alpha
  • Extrapolation of the form from L-BFGS
  • Converg alphatry

Include references

Add references to the algorithms that have been implemented.
As a first, just add them to the README.

If we ever write a documentation, we can move them there.

LineSearch gets stuck for no apparent reason

Hi,

I am running LBFGS optimization algorithm with MoreThuente linesearch algorithm.
I track the execution of the algorithm by damping the output of the trace into the terminal.

In some cases (which are, fortunately, rare), the optimization just gets stuck: there are no new messages in the trace.
My guess is that LineSearch algorithm gets stuck for some reason.

Could someone provide advice on how to better debug such cases where the LineSearch is stuck?
May be you have some ideas what the problem might be?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.