Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uchicago.src.sim.adaptation.neural
Class RepastNeuralWrapper

    java.lang.Object
      uchicago.src.sim.adaptation.neural.RepastNeuralWrapper

All Implemented Interfaces:
  java.io.Serializable, java.util.EventListener, org.joone.engine.NeuralNetListener

    public class RepastNeuralWrapper

extends java.lang.Object
implements org.joone.engine.NeuralNetListener, java.io.Serializable

A wrapper around a `NeuralNet`. This class adds training and retrieval methods that wait until the training/retrieval is finished before returning. Note: if you want serialize the network that this wrapper wraps, use the saveNetToFile and NeuralUtils.loadNetFromFile methods, otherwise you will have multiple wrappers attached to the serialized networks (through the listeners).

Version:
  $Revision: 1.4 $ $Date: 2005/08/12 16:13:29 $
Author:
  Jerry Vos
See Also:
  Serialized Form

Field Summary
`protected int` | `epochsPerIteration` The number of times to apply the patterns to the network during the training
`protected org.joone.net.NeuralNet` | `net` The net being wrapped
`protected boolean` | `netStopped` Whether or not the network is running (training/retrieving).

Constructor Summary
`RepastNeuralWrapper()` The default constructor for a network wrapper.
`RepastNeuralWrapper(org.joone.net.NeuralNet net)` This creates a basic network wrapper, however this cannot be used until `Layer`s, `Synapse`s, and so forth have been specified.

Method Summary
`void` | `cicleTerminated(org.joone.engine.NeuralNetEvent e)`
`void` | `errorChanged(org.joone.engine.NeuralNetEvent e)`
`int` | `getEpochsPerIteration()`
`org.joone.net.NeuralNet` | `getNet()`
`void` | `netStarted(org.joone.engine.NeuralNetEvent e)`
`void` | `netStopped(org.joone.engine.NeuralNetEvent e)`
`void` | `netStoppedError(org.joone.engine.NeuralNetEvent e, java.lang.String error)`
`org.joone.engine.Pattern` | `retrieve(org.joone.engine.InputPatternListener in)` This method will retrieve a result Pattern from a network based on the in parameter.
`void` | `saveNetToFile(java.lang.String fileName)` Saves the neural network this is wrapping to the specified file.
`void` | `setEpochsPerIteration(int epochsPerIteration)`
`void` | `setNet(org.joone.net.NeuralNet net)`
`void` | `train(org.joone.engine.InputPatternListener in)` Trains a network.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### net

    protected org.joone.net.NeuralNet net

  The net being wrapped

### epochsPerIteration

    protected int epochsPerIteration

  The number of times to apply the patterns to the network during the training

### netStopped

    protected transient boolean netStopped

  Whether or not the network is running (training/retrieving). This doesn't mean that the network's threads have all shut down, just that the network has signaled its start or stop.

Constructor Detail

### RepastNeuralWrapper

    public RepastNeuralWrapper()

  The default constructor for a network wrapper. This creates a basic network, however this cannot be used until `Layer`s, `Synapse`s, and so forth have been specified.
  Same as new RepastNeuralWrapper(new NeuralNet());

### RepastNeuralWrapper

    public RepastNeuralWrapper(org.joone.net.NeuralNet net)

  This creates a basic network wrapper, however this cannot be used until `Layer`s, `Synapse`s, and so forth have been specified.

Method Detail

### retrieve

    public org.joone.engine.Pattern retrieve(org.joone.engine.InputPatternListener in)
                                      throws NeuralException

  This method will retrieve a result Pattern from a network based on the in parameter.
  This method will remove all outputs and inputs from the network, and then it will add a DirectSynapse as an output, and the in parameter as an input. THESE ARE NOT RESTORED BY THE CALL.

  Parameters:
    `in` - The input to the network (best as a `DirectSynapse`)
  Returns:
    the Pattern resulting from running the network
  Throws:
    `NeuralException` - when there is an error querying the network

### train

    public void train(org.joone.engine.InputPatternListener in)
               throws NeuralException

  Trains a network. The network is expected to be fully built before this method is called.
  This method will remove all outputs and inputs from the network, and then it will add the network's teacher as an output, and the in parameter as an input. THESE ARE NOT RESTORED BY THE CALL.
  To use this method the network's teacher should have its desired output specified through a getTeacher().setDesired(..) call. Also the in should be setup to deliver at least one pattern to the network (this training only feeds one pattern through).
  Make sure before calling this method you specify the learning rate and momentum of the network's `Monitor`.

  Parameters:
    `in` - the input for the network.
  Throws:
    `NeuralException` - when there is an error training the network
  See Also:
    `NeuralNet.check()`, `retrieve(InputPatternListener)`

### getEpochsPerIteration

    public int getEpochsPerIteration()

  Returns:
    the number of times to feed a pattern through the network

### setEpochsPerIteration

    public void setEpochsPerIteration(int epochsPerIteration)

  Parameters:
    `epochsPerIteration` - the number of times to feed a pattern through the network

### netStarted

    public void netStarted(org.joone.engine.NeuralNetEvent e)

  Specified by:
    `netStarted` in interface `org.joone.engine.NeuralNetListener`

### netStopped

    public void netStopped(org.joone.engine.NeuralNetEvent e)

  Specified by:
    `netStopped` in interface `org.joone.engine.NeuralNetListener`

### netStoppedError

    public void netStoppedError(org.joone.engine.NeuralNetEvent e,
                                java.lang.String error)

  Specified by:
    `netStoppedError` in interface `org.joone.engine.NeuralNetListener`

### cicleTerminated

    public void cicleTerminated(org.joone.engine.NeuralNetEvent e)

  Specified by:
    `cicleTerminated` in interface `org.joone.engine.NeuralNetListener`

### errorChanged

    public void errorChanged(org.joone.engine.NeuralNetEvent e)

  Specified by:
    `errorChanged` in interface `org.joone.engine.NeuralNetListener`

### getNet

    public org.joone.net.NeuralNet getNet()

  Returns:
    the net this wrapper is wrapping

### setNet

    public void setNet(org.joone.net.NeuralNet net)

  Parameters:
    `net` - the new net to wrap

### saveNetToFile

    public void saveNetToFile(java.lang.String fileName)
                       throws NeuralException

  Saves the neural network this is wrapping to the specified file. This can be loaded through `#loadNetFromFile(String)`.

  Parameters:
    `fileName` - the name of the file to save the network to
  Throws:
    `NeuralException` - when there is an error saving the network
  See Also:
    `#loadNetFromFile(String)`, `NeuralUtils.saveNetToFile(NeuralNet, String)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD