edu.stanford.nlp.optimization
Class QNMinimizer
java.lang.Object
edu.stanford.nlp.optimization.QNMinimizer
- All Implemented Interfaces:
- Minimizer<DiffFunction>
public class QNMinimizer
- extends Object
- implements Minimizer<DiffFunction>
Limited-Memory Quasi-Newton BFGS implementation based on the algorithms in
Nocedal, Jorge, and Stephen J. Wright. 2000. Numerical Optimization. Springer. pp. 224--
As of now, it requires a
differentiable function (DiffFunction) as input.
The basic way to use the minimizer is with a null constructor, then
the simple minimize method:
Minimizer qnm = new QNMinimizer();
DiffFunction df = new SomeDiffFunction();
double tol = 1e-4;
double[] initial = getInitialGuess();
double[] minimum = qnm.minimize(df,tol,initial);
If you do not choose a value of M, it will use the max amount of memory
available, up to M of 20. This will slow things down a bit at first due
to forced garbage collection, but is probably faster overall b/c you are
guaranteed the largest possible M.
- Since:
- 1.0
- Author:
- Jenny Finkel, Galen Andrew
Method Summary |
static void |
main(String[] args)
|
double[] |
minimize(DiffFunction function,
double functionTolerance,
double[] initial)
Attempts to find an unconstrained minimum of the objective
function starting at initial , within
functionTolerance . |
double[] |
minimize(DiffFunction dfunction,
double functionTolerance,
double[] initial,
int maxIterations)
|
float[] |
minimize(FloatFunction function,
float functionTolerance,
float[] initial)
|
void |
setM(int m)
|
void |
shutUp()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
QNMinimizer
public QNMinimizer(int m)
QNMinimizer
public QNMinimizer()
QNMinimizer
public QNMinimizer(Function monitor)
QNMinimizer
public QNMinimizer(Function monitor,
int m)
QNMinimizer
public QNMinimizer(FloatFunction monitor)
shutUp
public void shutUp()
setM
public void setM(int m)
minimize
public double[] minimize(DiffFunction function,
double functionTolerance,
double[] initial)
- Description copied from interface:
Minimizer
- Attempts to find an unconstrained minimum of the objective
function
starting at initial
, within
functionTolerance
.
- Specified by:
minimize
in interface Minimizer<DiffFunction>
- Parameters:
function
- the objective functionfunctionTolerance
- a double
valueinitial
- a initial feasible point
minimize
public double[] minimize(DiffFunction dfunction,
double functionTolerance,
double[] initial,
int maxIterations)
- Specified by:
minimize
in interface Minimizer<DiffFunction>
minimize
public float[] minimize(FloatFunction function,
float functionTolerance,
float[] initial)
main
public static void main(String[] args)
Stanford NLP Group