public abstract class GradientDescent extends Object implements TrainingRule, IterativeProcess
| Modifier and Type | Field and Description |
|---|---|
static double |
DEFAULT_LEARNING_RATE
The default learning rate.
|
static double |
DEFAULT_MOMENTUM
The default momentum.
|
| Constructor and Description |
|---|
GradientDescent()
Creates a new gradient descent algorithm using default learning rate
and momentum values.
|
| Modifier and Type | Method and Description |
|---|---|
double |
getCurrentError()
Returns the error value after the last iteration.
|
int |
getCurrentIteration()
Returns the current iteration.
|
double |
getLastError()
Returns the error value before the last iteration.
|
double |
getLearningRate()
Returns the learning rate value.
|
double |
getMomentum()
Returns the momentum value.
|
StopCondition |
getStopCondition()
Returns a stop condition for this process.
|
protected void |
setCurrentError(double error)
Sets the current error value.
|
void |
setLearningRate(double rate)
Sets the learning rate value.
|
void |
setMomentum(double m)
Sets the momentum value.
|
void |
setStopCondition(StopCondition cond)
Sets a stop condition for this process.
|
void |
train(DataSet set)
Performs the training of a neural network.
|
protected abstract void |
trainExample(DataExample example)
Learn a single data example.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetNetworkpublic static final double DEFAULT_LEARNING_RATE
public static final double DEFAULT_MOMENTUM
public GradientDescent()
public final double getLearningRate()
public final void setLearningRate(double rate)
rate - the learning rate value. Must be a positive real
number.public final double getMomentum()
public final void setMomentum(double m)
m - the momentum. Must be a non-negative real number.public final double getCurrentError()
public final double getLastError()
public final void train(DataSet set)
TrainingRuletrain in interface TrainingRuleset - training data setpublic final int getCurrentIteration()
IterativeProcessgetCurrentIteration in interface IterativeProcesspublic final void setStopCondition(StopCondition cond)
IterativeProcesssetStopCondition in interface IterativeProcesscond - the stop condition. Cannot be null.public final StopCondition getStopCondition()
IterativeProcessgetStopCondition in interface IterativeProcessprotected abstract void trainExample(DataExample example)
example - protected final void setCurrentError(double error)
error - Copyright © 2012. All Rights Reserved.