|
JMSLTM Numerical Library 4.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.imsl.datamining.neural.EpochTrainer
Two-stage training using randomly selected training patterns in stage I. The epoch trainer, is a meta-trainer that combines two trainers. The first trainer is used on a series of randomly selected subsets of the training patterns. For each subset, the weights are initialized to their initial values plus a random offset.
Stage II then refines the result found in stage 1. The best result from
the stage 1 trainings is used as the initial guess with the second trainer
operating on the full set of training patterns. Stage II is optional, if the
second trainer is null then the best stage 1 result is returned
as the epoch trainer's result.
The Java Logging API can be used to trace
the performance training. The name of this logger is
com.imsl.datamining.EpochTrainer. Accumulated levels of detail
correspond to Java's FINE, FINER, and FINEST
logging levels with FINE yielding the smallest amount
of information and FINEST yielding the most. The levels of
output yield the following:
| Level | Output |
FINE | A message on entering
and exiting method train, a message entering and
exiting both stages 1 and 2, and a summary report (based on Network.computeStatistics(double[][], double[][])) upon completion of training. |
FINER | All of the messages in
FINE, a message entering and exiting each epoch in
stage 1, the input settings, the value of the function being
minimized in stage 1 for each epoch, a time stamp at the start of
each iteration in stage 1 and at the beginning and end of stage 2,
and (if there is a stage 2) a summary at the end of stage 1. |
FINEST | All of the messages
in FINER and a table of the computed weights and
their gradient values. |
Level,
Serialized Form| Constructor Summary | |
EpochTrainer(Trainer stage1Trainer)
Creates a single stage EpochTrainer. |
|
EpochTrainer(Trainer stage1Trainer,
Trainer stage2Trainer)
Creates an two-stage EpochTrainer. |
|
| Method Summary | |
int |
getEpochSize()
Returns the number of sample training patterns in each stage 1 epoch. |
double[] |
getErrorGradient()
Returns the value of the gradient of the error function with respect to the weights. |
int |
getErrorStatus()
Returns the training error status. |
double |
getErrorValue()
Returns the value of the error function. |
static Formatter |
getFormatter()
Returns the logging Formatter object. |
static Logger |
getLogger()
Returns the Logger object. |
int |
getNumberOfEpochs()
Returns the number of epochs used during stage I training. |
int |
getNumberOfThreads()
Gets the number of threads to use during stage I training. |
Random |
getRandom()
Returns the random number generator used to perturb the stage 1 guesses. |
protected com.imsl.datamining.neural.RandomSampleIndicies |
getRandomSampleIndicies()
Gets the random number generators used to select random training patterns in stage 1. |
protected Trainer |
getStage1Trainer()
Returns the stage 1 trainer. |
protected Trainer |
getStage2Trainer()
Returns the stage 1 trainer. |
protected int |
incrementEpochCount()
Increments the epoch counter. |
void |
setEpochSize(int epochSize)
Sets the number of randomly selected training patterns in stage 1 epoch. |
void |
setNumberOfEpochs(int numberOfEpochs)
Sets the number of epochs. |
void |
setNumberOfThreads(int number)
Sets the number of threads to use during stage I training. |
void |
setRandom(Random random)
Sets the random number generator used to perturb the initial stage 1 guesses. |
void |
setRandomSamples(Random randomA,
Random randomB)
Sets the random number generators used to select random training patterns in stage 1. |
void |
train(Network network,
double[][] xData,
double[][] yData)
Trains the neural network using supplied training patterns. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public EpochTrainer(Trainer stage1Trainer)
EpochTrainer. Stage 2 training is
bypassed.
stage1Trainer - The Trainer used in stage I.
public EpochTrainer(Trainer stage1Trainer,
Trainer stage2Trainer)
EpochTrainer.
stage1Trainer - The stage I Trainer.stage2Trainer - The stage II Trainer, or null
if stage II is to be bypassed.| Method Detail |
public int getEpochSize()
int which contains the number of sample training
patterns in each stage I epoch.public double[] getErrorGradient()
getErrorGradient in interface Trainerdouble array whose length is equal to the number
of Network weights, containing the value of
the gradient of the error function with respect to the
weights. Before training, null is returned.public int getErrorStatus()
getErrorStatus in interface Trainerint containing the error status from stage 2. If
there is no stage 2 then the number of stage 1 epochs that
returned a non-zero error status is returned.public double getErrorValue()
getErrorValue in interface Trainerdouble containing final value of the error
function from the last training. Before training, NaN
is returned.public static Formatter getFormatter()
Formatter object. Logger
support requires JDK1.4. Use with earlier versions returns null
.
The returned Formatter is used as input to Handler.setFormatter(java.util.logging.Formatter) to format the output log.
Formatter object, if present, or null
otherwise.public static Logger getLogger()
Logger object. This is the Logger
used to trace this class. It is named QuasiNewtonTrainer.
Logger object, if present, or null
otherwise.public int getNumberOfEpochs()
int which contains the number of epochs used
during stage I training.public int getNumberOfThreads()
int which contains the number of threads to use.public Random getRandom()
Random object used to generate stage 1
perturbations.protected com.imsl.datamining.neural.RandomSampleIndicies getRandomSampleIndicies()
RandomSampleIndicies containing the random
number generators.protected Trainer getStage1Trainer()
Trainer containing the stage 1 trainer.protected Trainer getStage2Trainer()
Trainer containing the stage 2 trainer.protected int incrementEpochCount()
public void setEpochSize(int epochSize)
epochSize - An int which specifies the number of
sample training patterns in each stage I epoch.
The default value is the number of observations in the
training data.public void setNumberOfEpochs(int numberOfEpochs)
numberOfEpochs - An int which specifies the number
of epochs to be used during stage I training.
The default value is 10.public void setNumberOfThreads(int number)
number - An int which specifies the number of
threads to use. Default: number = 1.public void setRandom(Random random)
random - The Random object used to set the random
number generator.
public void setRandomSamples(Random randomA,
Random randomB)
randomA - A Random object which is the first random
number generator.randomB - A Random object which is the second random
number generator, independent of randomA.
public void train(Network network,
double[][] xData,
double[][] yData)
train in interface Trainernetwork - The Network to be trained.xData - A double matrix specifying the input
training patterns. The number of columns in xData
must equal the number of Nodes in
the InputLayer.yData - A double containing the output training
patterns. The number of columns in yData
must equal the number of Perceptrons in the
OutputLayer.
Each row of xData and yData
contains a training pattern. These number of rows in two
arrays must be equal.
|
JMSLTM Numerical Library 4.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||