Package edu.stanford.nlp.optimization
Class SQNMinimizer<T extends Function>
- java.lang.Object
-
- edu.stanford.nlp.optimization.StochasticMinimizer<T>
-
- edu.stanford.nlp.optimization.SQNMinimizer<T>
-
- All Implemented Interfaces:
HasEvaluators,Minimizer<T>
public class SQNMinimizer<T extends Function> extends StochasticMinimizer<T>
Online Limited-Memory Quasi-Newton BFGS implementation based on the algorithms in
Nocedal, Jorge, and Stephen J. Wright. 2000. Numerical Optimization. Springer. pp. 224--
and modified to the online version presented in
A Stocahstic Quasi-Newton Method for Online Convex Optimization Schraudolph, Yu, Gunter (2007)
As of now, it requires a Stochastic differentiable function (AbstractStochasticCachingDiffFunction) as input.
The basic way to use the minimizer is with a null constructor, then the simple minimize method: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! THIS IS NOT UPDATE FOR THE STOCHASTIC VERSION YET. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
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. The Stochastic version was written by Alex Kleeman, but about 95% of the code was taken directly from the previous QNMinimizer written mostly by Jenny.- Since:
- 1.0
- Version:
- 1.0
- Author:
- Jenny Finkel, Galen Andrew, Alex Kleeman
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class edu.stanford.nlp.optimization.StochasticMinimizer
StochasticMinimizer.PropertySetter<T1>
-
-
Constructor Summary
Constructors Constructor Description SQNMinimizer()SQNMinimizer(int m)SQNMinimizer(int mem, double initialGain, int batchSize, boolean output)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetName()protected voidinit(AbstractStochasticCachingDiffFunction func)voidsetM(int m)protected voidtakeStep(AbstractStochasticCachingDiffFunction dfunction)Pair<Integer,Double>tune(Function function, double[] initial, long msPerTest)-
Methods inherited from class edu.stanford.nlp.optimization.StochasticMinimizer
gainSchedule, minimize, minimize, say, sayln, setEvaluators, shutUp, smooth, tune, tuneBatch, tuneDouble, tuneDouble, tuneGain
-
-
-
-
Method Detail
-
setM
public void setM(int m)
-
getName
public String getName()
- Specified by:
getNamein classStochasticMinimizer<T extends Function>
-
tune
public Pair<Integer,Double> tune(Function function, double[] initial, long msPerTest)
- Specified by:
tunein classStochasticMinimizer<T extends Function>
-
init
protected void init(AbstractStochasticCachingDiffFunction func)
- Overrides:
initin classStochasticMinimizer<T extends Function>
-
takeStep
protected void takeStep(AbstractStochasticCachingDiffFunction dfunction)
- Specified by:
takeStepin classStochasticMinimizer<T extends Function>
-
-