public abstract class Trainer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
Trainer.DataNotInitializedException
Exception thrown when a training algorithm is applied but no data have
been initialized.
|
Modifier and Type | Field and Description |
---|---|
protected Trainable |
network
The trainable object to be trained.
|
Constructor and Description |
---|
Trainer(Trainable network)
Construct the trainer and pass in a reference to the trainable element.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(TrainerListener trainerListener)
Add a trainer listener.
|
abstract void |
apply()
Apply the algorithm.
|
void |
fireProgressUpdate(java.lang.String progressUpdate,
int percentComplete)
Notify listeners of an update in training progress.
|
void |
fireTrainingBegin()
Notify listeners that training has begin.
|
void |
fireTrainingEnd()
Notify listeners that training has ended.
|
java.util.List<TrainerListener> |
getListeners() |
static Trainable |
getTrainable(Group trainedGroup,
java.util.List<Neuron> inputNeurons,
java.util.List<Neuron> outputNeurons,
double[][] inputData,
double[][] targetData)
Utility method for creating a trainable object.
|
Trainable |
getTrainableNetwork() |
void |
removeListener(TrainerListener trainerListener)
Remove a trainer listener.
|
void |
revalidateSynapseGroups()
Helper function to update synapse groups whose synapses may have changed
based on training.
|
protected final Trainable network
public Trainer(Trainable network)
network
- the network to be trainedpublic abstract void apply() throws Trainer.DataNotInitializedException
Trainer.DataNotInitializedException
- when input or target data have not been set.public void addListener(TrainerListener trainerListener)
trainerListener
- the listener to addpublic void removeListener(TrainerListener trainerListener)
trainerListener
- the listener to addpublic java.util.List<TrainerListener> getListeners()
public void fireTrainingBegin()
public void fireTrainingEnd()
public void fireProgressUpdate(java.lang.String progressUpdate, int percentComplete)
progressUpdate
- string description of current statepercentComplete
- how far along the training is.public Trainable getTrainableNetwork()
public void revalidateSynapseGroups()
public static Trainable getTrainable(Group trainedGroup, java.util.List<Neuron> inputNeurons, java.util.List<Neuron> outputNeurons, double[][] inputData, double[][] targetData)
trainedGroup
- the subnet or synapse group being trained.inputNeurons
- the input neuronsoutputNeurons
- the output neuronsinputData
- the input datatargetData
- the target data