edu.stanford.nlp.optimization
Class SGDMinimizer<T extends Function>
java.lang.Object
edu.stanford.nlp.optimization.StochasticMinimizer<T>
edu.stanford.nlp.optimization.SGDMinimizer<T>
- All Implemented Interfaces:
- HasEvaluators, Minimizer<T>
public class SGDMinimizer<T extends Function>
- extends StochasticMinimizer<T>
Stochastic Gradient Descent Minimizer
The basic way to use the minimizer is with a null constructor, then
the simple minimize method:
Minimizer smd = new SGDMinimizer();
DiffFunction df = new SomeDiffFunction(); //Note that it must be a incidence of AbstractStochasticCachingDiffFunction
double tol = 1e-4;
double[] initial = getInitialGuess();
int maxIterations = someSafeNumber;
double[] minimum = qnm.minimize(df,tol,initial,maxIterations);
Constructing with a null constructor will use the default values of
batchSize = 15;
initialGain = 0.1;
- Since:
- 1.0
- Author:
- Alex Kleeman
Fields inherited from class edu.stanford.nlp.optimization.StochasticMinimizer |
bSize, file, gain, gen, grad, gradList, infoFile, k, maxTime, memory, newGrad, newX, numBatches, numPasses, outputFrequency, outputIterationsToFile, quiet, v, x |
Constructor Summary |
SGDMinimizer()
|
SGDMinimizer(double SGDGain,
int batchSize)
|
SGDMinimizer(double SGDGain,
int batchSize,
int passes)
|
SGDMinimizer(double SGDGain,
int batchSize,
int passes,
boolean outputToFile)
|
SGDMinimizer(double SGDGain,
int batchSize,
int passes,
long maxTime)
|
SGDMinimizer(double SGDGain,
int batchSize,
int passes,
long maxTime,
boolean outputToFile)
|
Methods inherited from class edu.stanford.nlp.optimization.StochasticMinimizer |
gainSchedule, init, minimize, minimize, say, sayln, setEvaluators, smooth, tune, tuneBatch, tuneDouble, tuneDouble, tuneGain |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SGDMinimizer
public SGDMinimizer()
SGDMinimizer
public SGDMinimizer(double SGDGain,
int batchSize)
SGDMinimizer
public SGDMinimizer(double SGDGain,
int batchSize,
int passes)
SGDMinimizer
public SGDMinimizer(double SGDGain,
int batchSize,
int passes,
boolean outputToFile)
SGDMinimizer
public SGDMinimizer(double SGDGain,
int batchSize,
int passes,
long maxTime)
SGDMinimizer
public SGDMinimizer(double SGDGain,
int batchSize,
int passes,
long maxTime,
boolean outputToFile)
shutUp
public void shutUp()
- Overrides:
shutUp
in class StochasticMinimizer<T extends Function>
setBatchSize
public void setBatchSize(int batchSize)
getName
protected java.lang.String getName()
- Specified by:
getName
in class StochasticMinimizer<T extends Function>
tune
public Pair<java.lang.Integer,java.lang.Double> tune(Function function,
double[] initial,
long msPerTest,
double gainLow,
double gainHigh)
tune
public Pair<java.lang.Integer,java.lang.Double> tune(Function function,
double[] initial,
long msPerTest)
- Specified by:
tune
in class StochasticMinimizer<T extends Function>
takeStep
protected void takeStep(AbstractStochasticCachingDiffFunction dfunction)
- Specified by:
takeStep
in class StochasticMinimizer<T extends Function>
main
public static void main(java.lang.String[] args)
Stanford NLP Group