Documentation of 'jsat.math.optimization.LBFGS' Java class
LBFGS
jsat.math.optimization

Class LBFGS

  • All Implemented Interfaces:
    Optimizer


    public class LBFGS
    extends java.lang.Object
    implements Optimizer
    Implementation of the Limited memory variant of BFGS. It uses a history of m items to solve n dimension problems with O(m n) work per iteration.
    • Constructor Summary

      Constructors 
      Constructor and Description
      LBFGS()
      Creates a new L-BFGS optimization object that uses a maximum of 500 iterations and a Backtracking line search.
      LBFGS(int m)
      Creates a new L-BFGS optimization object that uses a maximum of 500 iterations and a Backtracking line search.
      LBFGS(int m, int maxIterations, LineSearch lineSearch)
      Creates a new L-BFGS optimization object
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      LBFGS clone() 
      LineSearch getLineSearch()
      Returns the line search method used at each iteration
      int getM()
      Returns the number of history items that will be used
      int getMaximumIterations()
      Returns the maximum number of iterations to perform
      boolean isInftNormCriterion()
      Returns whether or not the infinity norm (true) or 2 norm (false) is used to determine convergence.
      void optimize(double tolerance, Vec w, Vec x0, Function f, FunctionVec fp, boolean parallel)
      Attempts to optimize the given function by finding the value of w that will minimize the value returned by f(w), using w = x0 as an initial starting point.
      void setInftNormCriterion(boolean inftNormCriterion)
      By default the infinity norm is used to judge convergence.
      void setLineSearch(LineSearch lineSearch)
      Sets the line search method used at each iteration
      void setM(int m)
      Sets the number of history items to keep that are used to approximate the Hessian of the problem
      void setMaximumIterations(int iterations)
      Sets the maximum number of iterations allowed for the optimization method
      static void twoLoopHp(Vec x_grad, java.util.List<java.lang.Double> rho, java.util.List<Vec> s, java.util.List<Vec> y, Vec q, double[] alphas)
      See Algorithm 7.4 (L-BFGS two-loop recursion).
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LBFGS

        public LBFGS()
        Creates a new L-BFGS optimization object that uses a maximum of 500 iterations and a Backtracking line search. A history of 10 items will be used
      • LBFGS

        public LBFGS(int m)
        Creates a new L-BFGS optimization object that uses a maximum of 500 iterations and a Backtracking line search.
        Parameters:
        m - the number of history items
      • LBFGS

        public LBFGS(int m,
                     int maxIterations,
                     LineSearch lineSearch)
        Creates a new L-BFGS optimization object
        Parameters:
        m - the number of history items
        maxIterations - the maximum number of iterations before stopping
        lineSearch - the line search method to use for optimization
    • Method Detail

      • twoLoopHp

        public static void twoLoopHp(Vec x_grad,
                                     java.util.List<java.lang.Double> rho,
                                     java.util.List<Vec> s,
                                     java.util.List<Vec> y,
                                     Vec q,
                                     double[] alphas)
        See Algorithm 7.4 (L-BFGS two-loop recursion).
        Parameters:
        x_grad - the initial value ∇ fk
        rho -
        s -
        y -
        q - the location to store the value of Hk ∇ fk
        alphas - temp space to do work, should be as large as the number of history vectors
      • optimize

        public void optimize(double tolerance,
                             Vec w,
                             Vec x0,
                             Function f,
                             FunctionVec fp,
                             boolean parallel)
        Description copied from interface: Optimizer
        Attempts to optimize the given function by finding the value of w that will minimize the value returned by f(w), using w = x0 as an initial starting point.
        Specified by:
        optimize in interface Optimizer
        Parameters:
        tolerance - the value that the gradient norm must be less than to consider converged
        w - the the location to store the final solution
        x0 - the initial guess for the solution. This value will not be changed, and intermediate matrices will be created as the same type.
        f - the objective function to minimizer
        fp - the derivative of the objective function, may be null depending on the optimizer
        parallel - true if multiple threads should be used for optimization, or false if a single thread should be used.
      • setInftNormCriterion

        public void setInftNormCriterion(boolean inftNormCriterion)
        By default the infinity norm is used to judge convergence. If set to false, the 2 norm will be used instead.
        Parameters:
        inftNormCriterion -
      • isInftNormCriterion

        public boolean isInftNormCriterion()
        Returns whether or not the infinity norm (true) or 2 norm (false) is used to determine convergence.
        Returns:
        true if the infinity norm is in use, false for the 2 norm
      • setM

        public void setM(int m)
        Sets the number of history items to keep that are used to approximate the Hessian of the problem
        Parameters:
        m - the number of history items to keep
      • getM

        public int getM()
        Returns the number of history items that will be used
        Returns:
        the number of history items that will be used
      • setLineSearch

        public void setLineSearch(LineSearch lineSearch)
        Sets the line search method used at each iteration
        Parameters:
        lineSearch - the line search method used at each iteration
      • getLineSearch

        public LineSearch getLineSearch()
        Returns the line search method used at each iteration
        Returns:
        the line search method used at each iteration
      • setMaximumIterations

        public void setMaximumIterations(int iterations)
        Description copied from interface: Optimizer
        Sets the maximum number of iterations allowed for the optimization method
        Specified by:
        setMaximumIterations in interface Optimizer
        Parameters:
        iterations - the maximum number of iterations to perform
      • getMaximumIterations

        public int getMaximumIterations()
        Description copied from interface: Optimizer
        Returns the maximum number of iterations to perform
        Specified by:
        getMaximumIterations in interface Optimizer
        Returns:
        the maximum number of iterations to perform
      • clone

        public LBFGS clone()
        Specified by:
        clone in interface Optimizer
        Overrides:
        clone in class java.lang.Object

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.