org.jscience.computing.ai.neurocomputing
Class NeuralNetworkTrainer

java.lang.Object
  extended by org.jscience.computing.ai.neurocomputing.NeuralNetworkTrainer
All Implemented Interfaces:
Steppable
Direct Known Subclasses:
KohonenTrainer

public abstract class NeuralNetworkTrainer
extends java.lang.Object
implements Steppable

This class is intended to provide a common interface for the more complicated neural network training algorithms, such as a multi-stage Kohonen training algorithm. {@link org.jscience.computing.ai.neurocomputing.NeuralNetwork#train(double[],double[]) should only implement one iteration of the training algorithm, and if this algorithm has multiple stages, variables or other complicating factors, it may be easier to use NeuralNetworkTrainer to provide the overall framework.

In addition to this, a NeuralNetworkTrainer-derived class can be created to deal with a specific training situation. Continuing with our Kohonen example, you could create a trainer for simple 2D shapes, mapping RGB colours, or complex image association.

Finally, NeuralNetworkTrainer also implements Steppable adding greater flexibility/integration when creating demonstration applets/ applications.

See Also:
NeuralNetwork.train(double[],double[])

Field Summary
protected  Notifier notifier
          A simple interface that allows a NeuralNetworkTrainer to notify additional classes about events.
 
Constructor Summary
NeuralNetworkTrainer()
          Creates a new instance of NeuralNetworkTrainer
 
Method Summary
abstract  void doStep()
          Advance the training one step.
abstract  NeuralNetwork getNetwork()
          Return the network being used.
abstract  void init()
          Initialize the training algorithm.
abstract  boolean isComplete()
          Returns true is training is complete.
 void reset()
          Reset the training algorithm (defaults to calling init).
 void run()
          Run the training algorithm.
abstract  void setNetwork(NeuralNetwork net)
          Set the network being used by the trainer.
 void setNotifier(Notifier notify)
          Set the notifier for this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

notifier

protected Notifier notifier
A simple interface that allows a NeuralNetworkTrainer to notify additional classes about events.

Constructor Detail

NeuralNetworkTrainer

public NeuralNetworkTrainer()
Creates a new instance of NeuralNetworkTrainer

Method Detail

setNetwork

public abstract void setNetwork(NeuralNetwork net)
Set the network being used by the trainer.

Parameters:
net - the network to be trained.

getNetwork

public abstract NeuralNetwork getNetwork()
Return the network being used.

Returns:
the network currently being trained.

setNotifier

public void setNotifier(Notifier notify)
Set the notifier for this class.

Parameters:
notify - the neural network notifier.

isComplete

public abstract boolean isComplete()
Returns true is training is complete.

Returns:
true, if training has finished, otherwise false.

doStep

public abstract void doStep()
Advance the training one step.

Specified by:
doStep in interface Steppable

init

public abstract void init()
Initialize the training algorithm.

Specified by:
init in interface Steppable

reset

public void reset()
Reset the training algorithm (defaults to calling init).

Specified by:
reset in interface Steppable

run

public void run()
Run the training algorithm. This method is simply defined as: public void run() { while (!isComplete()) { doStep(); } }