LineSearch (Apache OpenNLP Tools 2.5.9 API)
Description: declaration: package: opennlp.tools.ml.maxent.quasinewton, class: LineSearch

# Class LineSearch

java.lang.Object
opennlp.tools.ml.maxent.quasinewton.LineSearch

public class LineSearch extends Object
Performs line search to find a minimum.

See Also:
  - Nocedal invalid input: '&' Wright 2006, Numerical Optimization, p. 37)

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `LineSearch.LineSearchResult`
  Represents a `LineSearch` result encapsulating the relevant data at a point in time during computation.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LineSearch()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `doConstrainedLineSearch(Function function, double[] direction, LineSearch.LineSearchResult lsr, double l1Cost, double initialStepSize)`
  Conducts a constrained line search (see section 3.2 in the paper "Scalable Training of L1-Regularized Log-Linear Models", Andrew et al. 2007)
  `static void`
  `doLineSearch(Function function, double[] direction, LineSearch.LineSearchResult lsr, double initialStepSize)`
  Conducts a backtracking line search.

  ### Methods inherited from class Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### LineSearch

    public LineSearch()

- ## Method Details

  - ### doLineSearch

    public static void doLineSearch(Function function, double[] direction, LineSearch.LineSearchResult lsr, double initialStepSize)
    Conducts a backtracking line search.
    Parameters:
      `function` - The `Function` to apply.
      `direction` - The `double[]` representing the direction to search into.
      `lsr` - The `LineSearch.LineSearchResult` to transport results in.
      `initialStepSize` - The initial step size to apply. Must be greater than `0`.

  - ### doConstrainedLineSearch

    public static void doConstrainedLineSearch(Function function, double[] direction, LineSearch.LineSearchResult lsr, double l1Cost, double initialStepSize)
    Conducts a constrained line search (see section 3.2 in the paper "Scalable Training of L1-Regularized Log-Linear Models", Andrew et al. 2007)
    Parameters:
      `function` - The `Function` to apply.
      `direction` - The `double[]` representing the direction to search into.
      `lsr` - The `LineSearch.LineSearchResult` to transport results in.
      `l1Cost` - The L1-regularization costs. Must be equal or greater than `0`.
      `initialStepSize` - The initial step size to apply. Must be greater than `0`.