public class FunctionMinimizerGradientDescent extends AbstractAnytimeFunctionMinimizer<Vector,java.lang.Double,DifferentiableEvaluator<? super Vector,java.lang.Double,Vector>>
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_LEARNING_RATE
Default learning rate
|
static int |
DEFAULT_MAX_ITERATIONS
Default max iterations
|
static double |
DEFAULT_MOMENTUM
Default momentum
|
static double |
DEFAULT_TOLERANCE
Default tolerance
|
initialGuess, result, tolerance
data, keepGoing
maxIterations
DEFAULT_ITERATION, iteration
Constructor and Description |
---|
FunctionMinimizerGradientDescent()
Creates a new instance of FunctionMinimizerGradientDescent
|
FunctionMinimizerGradientDescent(double learningRate,
double momentum)
Creates a new instance of FunctionMinimizerGradientDescent
|
FunctionMinimizerGradientDescent(double learningRate,
double momentum,
Vector initialGuess,
double tolerance,
int maxIterations)
Creates a new instance of FunctionMinimizerGradientDescent
|
Modifier and Type | Method and Description |
---|---|
protected void |
cleanupAlgorithm()
Called to clean up the learning algorithm's state after learning has
finished.
|
double |
getLearningRate()
Getter for learningRate
|
double |
getMomentum()
Setter for momentum
|
protected boolean |
initializeAlgorithm()
Called to initialize the learning algorithm's state based on the
data that is stored in the data field.
|
void |
setLearningRate(double learningRate)
Setter for learningRate
|
void |
setMomentum(double momentum)
Getter for momentum
|
protected boolean |
step()
Called to take a single step of the learning algorithm.
|
getInitialGuess, getResult, getTolerance, setInitialGuess, setResult, setTolerance
clone, getData, getKeepGoing, learn, setData, setKeepGoing, stop
getMaxIterations, isResultValid, setMaxIterations
addIterativeAlgorithmListener, fireAlgorithmEnded, fireAlgorithmStarted, fireStepEnded, fireStepStarted, getIteration, getListeners, removeIterativeAlgorithmListener, setIteration, setListeners
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
learn
clone
getMaxIterations, setMaxIterations
addIterativeAlgorithmListener, getIteration, removeIterativeAlgorithmListener
isResultValid, stop
public static final double DEFAULT_LEARNING_RATE
public static final double DEFAULT_MOMENTUM
public static final double DEFAULT_TOLERANCE
public static final int DEFAULT_MAX_ITERATIONS
public FunctionMinimizerGradientDescent()
public FunctionMinimizerGradientDescent(double learningRate, double momentum)
learningRate
- The learning rate (or step size), must be (0,1], typically ~0.1momentum
- The momentum rate, must be [0,1), typically ~0.8public FunctionMinimizerGradientDescent(double learningRate, double momentum, Vector initialGuess, double tolerance, int maxIterations)
learningRate
- The learning rate (or step size), must be (0,1], typically ~0.1momentum
- The momentum rate, must be [0,1), typically ~0.8initialGuess
- Initial guess of the minimumtolerance
- Tolerance of the algorithm, must be >=0.0, typically 1e-5maxIterations
- Maximum number of iterations before stopping, must be >0, typically ~1000protected boolean initializeAlgorithm()
initializeAlgorithm
in class AbstractAnytimeBatchLearner<DifferentiableEvaluator<? super Vector,java.lang.Double,Vector>,InputOutputPair<Vector,java.lang.Double>>
protected boolean step()
step
in class AbstractAnytimeBatchLearner<DifferentiableEvaluator<? super Vector,java.lang.Double,Vector>,InputOutputPair<Vector,java.lang.Double>>
protected void cleanupAlgorithm()
cleanupAlgorithm
in class AbstractAnytimeBatchLearner<DifferentiableEvaluator<? super Vector,java.lang.Double,Vector>,InputOutputPair<Vector,java.lang.Double>>
public double getLearningRate()
public void setLearningRate(double learningRate)
learningRate
- The learning rate (or step size), must be (0,1], typically ~0.1public double getMomentum()
public void setMomentum(double momentum)
momentum
- The momentum rate, must be [0,1), typically ~0.8