edu.stanford.nlp.optimization
Class SGDMinimizer
java.lang.Object
edu.stanford.nlp.optimization.SGDMinimizer
- All Implemented Interfaces:
- Minimizer
public class SGDMinimizer
- extends Object
- implements Minimizer
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
Method Summary |
static void |
main(String[] args)
|
double[] |
minimize(Function function,
double functionTolerance,
double[] initial)
Attempts to find an unconstrained minimum of the objective
function starting at initial , within
functionTolerance . |
double[] |
minimize(Function function,
double functionTolerance,
double[] initial,
int maxIterations)
|
void |
setBatchSize(int batchSize)
|
void |
shutUp()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
outputIterationsToFile
public boolean outputIterationsToFile
outputFrequency
public int outputFrequency
gain
public double gain
SGDMinimizer
public SGDMinimizer()
SGDMinimizer
public SGDMinimizer(double SGDGain,
int batchSize)
shutUp
public void shutUp()
setBatchSize
public void setBatchSize(int batchSize)
minimize
public double[] minimize(Function 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
- Parameters:
function
- the objective functionfunctionTolerance
- a double
valueinitial
- a initial feasible point
minimize
public double[] minimize(Function function,
double functionTolerance,
double[] initial,
int maxIterations)
- Specified by:
minimize
in interface Minimizer
main
public static void main(String[] args)
Stanford NLP Group