edu.stanford.nlp.optimization
Class ScaledSGDMinimizer

java.lang.Object
  extended by edu.stanford.nlp.optimization.StochasticMinimizer
      extended by edu.stanford.nlp.optimization.ScaledSGDMinimizer
All Implemented Interfaces:
HasEvaluators, Minimizer

public class ScaledSGDMinimizer
extends StochasticMinimizer

Stochastic Gradient Descent To Quasi Newton Minimizer An experimental minimizer which takes a stochastic function (one implementing AbstractStochasticCachingDiffFunction) and executes SGD for the first couple passes, During the final iterations a series of approximate hessian vector products are built up... These are then passed to the QNminimizer so that it can start right up without the typical delay.

Since:
1.0
Author:
Alex Kleeman

Nested Class Summary
 class ScaledSGDMinimizer.weight
           
 
Nested classes/interfaces inherited from class edu.stanford.nlp.optimization.StochasticMinimizer
StochasticMinimizer.InvalidElementException, StochasticMinimizer.PropertySetter<T1>
 
Field Summary
 double[] diag
           
 List<double[]> sList
           
 List<double[]> yList
           
 
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
ScaledSGDMinimizer(double SGDGain, int batchSize)
           
ScaledSGDMinimizer(double SGDGain, int batchSize, int sgdPasses)
           
ScaledSGDMinimizer(double SGDGain, int batchSize, int sgdPasses, int method)
           
ScaledSGDMinimizer(double SGDGain, int batchSize, int sgdPasses, int method, boolean outputToFile)
           
ScaledSGDMinimizer(SeqClassifierFlags flags)
           
 
Method Summary
 double[] getDiag(String loadPath)
           
 String getName()
           
 double[] getWeights(String loadPath)
           
protected  void init(AbstractStochasticCachingDiffFunction func)
           
 void serializeWeights(String serializePath, double[] weights)
           
 void serializeWeights(String serializePath, double[] weights, double[] diag)
           
 void setBatchSize(int batchSize)
           
 void setMaxTime(Long max)
           
 void shutUp()
           
protected  void takeStep(AbstractStochasticCachingDiffFunction dfunction)
           
 Pair<Integer,Double> tune(Function function, double[] initial, long msPerTest)
           
 double tuneFixedGain(Function function, double[] initial, long msPerTest, double fixedStart)
           
 
Methods inherited from class edu.stanford.nlp.optimization.StochasticMinimizer
gainSchedule, 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
 

Field Detail

yList

public List<double[]> yList

sList

public List<double[]> sList

diag

public double[] diag
Constructor Detail

ScaledSGDMinimizer

public ScaledSGDMinimizer(SeqClassifierFlags flags)

ScaledSGDMinimizer

public ScaledSGDMinimizer(double SGDGain,
                          int batchSize,
                          int sgdPasses)

ScaledSGDMinimizer

public ScaledSGDMinimizer(double SGDGain,
                          int batchSize,
                          int sgdPasses,
                          int method)

ScaledSGDMinimizer

public ScaledSGDMinimizer(double SGDGain,
                          int batchSize,
                          int sgdPasses,
                          int method,
                          boolean outputToFile)

ScaledSGDMinimizer

public ScaledSGDMinimizer(double SGDGain,
                          int batchSize)
Method Detail

tuneFixedGain

public double tuneFixedGain(Function function,
                            double[] initial,
                            long msPerTest,
                            double fixedStart)

tune

public Pair<Integer,Double> tune(Function function,
                                 double[] initial,
                                 long msPerTest)
Specified by:
tune in class StochasticMinimizer

shutUp

public void shutUp()
Overrides:
shutUp in class StochasticMinimizer

setBatchSize

public void setBatchSize(int batchSize)

setMaxTime

public void setMaxTime(Long max)

getName

public String getName()
Specified by:
getName in class StochasticMinimizer

takeStep

protected void takeStep(AbstractStochasticCachingDiffFunction dfunction)
Specified by:
takeStep in class StochasticMinimizer

init

protected void init(AbstractStochasticCachingDiffFunction func)
Overrides:
init in class StochasticMinimizer

serializeWeights

public void serializeWeights(String serializePath,
                             double[] weights)

serializeWeights

public void serializeWeights(String serializePath,
                             double[] weights,
                             double[] diag)

getWeights

public double[] getWeights(String loadPath)
                    throws IOException,
                           ClassCastException,
                           ClassNotFoundException
Throws:
IOException
ClassCastException
ClassNotFoundException

getDiag

public double[] getDiag(String loadPath)
                 throws IOException,
                        ClassCastException,
                        ClassNotFoundException
Throws:
IOException
ClassCastException
ClassNotFoundException


Stanford NLP Group