Algorithm-LBFGS

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

      my $log = [];

      fmin($eval_cb, $x0, 'logging', $log);
  
      use Data::Dumper;
      print Dumper $log;

   user_data
    The extra user data. It will be sent to both "evaluation_cb" and
    "progress_cb".

  get_status
    Get the status of previous call of "fmin".

      ...
      $o->fmin(...);

      # check the status
      if ($o->get_status eq 'LBFGS_OK') {
         ...
      }

      # print the status out
      print $o->get_status;

    The status code is a string, which could be one of those in the "List of
    Status Codes".

  status_ok
    This is a shortcut of saying "get_status" eq "LBFGS_OK".

      ...

      if ($o->fmin(...), $o->status_ok) {
          ...
      }

  List of Parameters
   m
    The number of corrections to approximate the inverse hessian matrix.

    The L-BFGS algorithm stores the computation results of previous "m"
    iterations to approximate the inverse hessian matrix of the current
    iteration. This parameter controls the size of the limited memories
    (corrections). The default value is 6. Values less than 3 are not
    recommended. Large values will result in excessive computing time.

   epsilon
    Epsilon for convergence test.

    This parameter determines the accuracy with which the solution is to be
    found. A minimization terminates when

      ||grad f(x)|| < epsilon * max(1, ||x||)

    where ||.|| denotes the Euclidean (L2) norm. The default value is 1e-5.

   max_iterations
    The maximum number of iterations.

    The L-BFGS algorithm terminates an optimization process with
    "LBFGSERR_MAXIMUMITERATION" status code when the iteration count
    exceedes this parameter. Setting this parameter to zero continues an
    optimization process until a convergence or error. The default value is
    0.

   max_linesearch
    The maximum number of trials for the line search.

    This parameter controls the number of function and gradients evaluations
    per iteration for the line search routine. The default value is 20.

   min_step
    The minimum step of the line search routine.

    The default value is 1e-20. This value need not be modified unless the
    exponents are too large for the machine being used, or unless the
    problem is extremely badly scaled (in which case the exponents should be
    increased).

   max_step
    The maximum step of the line search.

    The default value is 1e+20. This value need not be modified unless the
    exponents are too large for the machine being used, or unless the
    problem is extremely badly scaled (in which case the exponents should be
    increased).

   ftol
    A parameter to control the accuracy of the line search routine.

    The default value is 1e-4. This parameter should be greater than zero
    and smaller than 0.5.

   gtol
    A parameter to control the accuracy of the line search routine.

    The default value is 0.9. If the function and gradient evaluations are
    inexpensive with respect to the cost of the iteration (which is
    sometimes the case when solving very large problems) it may be
    advantageous to set this parameter to a small value. A typical small
    value is 0.1. This parameter shuold be greater than the ftol parameter
    (1e-4) and smaller than 1.0.

   xtol
    The machine precision for floating-point values.

    This parameter must be a positive value set by a client program to
    estimate the machine precision. The line search routine will terminate
    with the status code ("LBFGSERR_ROUNDING_ERROR") if the relative width
    of the interval of uncertainty is less than this parameter.

   orthantwise_c
    Coeefficient for the L1 norm of variables.

    This parameter should be set to zero for standard minimization problems.
    Setting this parameter to a positive value minimizes the objective
    function f(x) combined with the L1 norm |x| of the variables, f(x) +
    c|x|. This parameter is the coeefficient for the |x|, i.e., c. As the L1
    norm |x| is not differentiable at zero, the module modify function and
    gradient evaluations from a client program suitably; a client program
    thus have only to return the function value f(x) and gradients grad f(x)
    as usual. The default value is zero.

  List of Status Codes
   LBFGS_OK
    No error occured.

   LBFGSERR_UNKNOWNERROR
    Unknown error.

   LBFGSERR_LOGICERROR
    Logic error.

   LBFGSERR_OUTOFMEMORY
    Insufficient memory.

   LBFGSERR_CANCELED
    The minimization process has been canceled.

   LBFGSERR_INVALID_N
    Invalid number of variables specified.

   LBFGSERR_INVALID_N_SSE
    Invalid number of variables (for SSE) specified.

   LBFGSERR_INVALID_MINSTEP
    Invalid parameter "max_step" specified.

   LBFGSERR_INVALID_MAXSTEP
    Invalid parameter "max_step" specified.

   LBFGSERR_INVALID_FTOL
    Invalid parameter "ftol" specified.

   LBFGSERR_INVALID_GTOL
    Invalid parameter "gtol" specified.

   LBFGSERR_INVALID_XTOL
    Invalid parameter "xtol" specified.

   LBFGSERR_INVALID_MAXLINESEARCH
    Invalid parameter "max_linesearch" specified.

   LBFGSERR_INVALID_ORTHANTWISE
    Invalid parameter "orthantwise_c" specified.

   LBFGSERR_OUTOFINTERVAL
    The line-search step went out of the interval of uncertainty.

   LBFGSERR_INCORRECT_TMINMAX
    A logic error occurred; alternatively, the interval of uncertainty
    became too small.

   LBFGSERR_ROUNDING_ERROR
    A rounding error occurred; alternatively, no line-search step satisfies
    the sufficient decrease and curvature conditions.

   LBFGSERR_MINIMUMSTEP
    The line-search step became smaller than "min_step".

   LBFGSERR_MAXIMUMSTEP
    The line-search step became larger than "max_step".

   LBFGSERR_MAXIMUMLINESEARCH
    The line-search routine reaches the maximum number of evaluations.

   LBFGSERR_MAXIMUMITERATION
    The algorithm routine reaches the maximum number of iterations.

   LBFGSERR_WIDTHTOOSMALL
    Relative width of the interval of uncertainty is at most "xtol".

   LBFGSERR_INVALIDPARAMETERS
    A logic error (negative line-search step) occurred.

   LBFGSERR_INCREASEGRADIENT
    The current search direction increases the objective function value.



( run in 0.634 second using v1.01-cache-2.11-cpan-13bb782fe5a )