net.openai.ai.nn.network
Class Network

java.lang.Object
  |
  +--net.openai.ai.nn.network.Network
All Implemented Interfaces:
java.io.Serializable

public class Network
extends java.lang.Object
implements java.io.Serializable

This class encapsulates all global info on the neural network and contains information on the architecture type and error type. All layers for the network are contained here as well...

See Also:
Serialized Form

Constructor Summary
Network()
          Constructor declaration
Network(java.lang.String networkFileName)
          Constructor use to create a network from a configuration file.
 
Method Summary
 void addCriterionReachedEventListener(CriterionReachedEventListener listener)
          Adds a criterion reached event listener.
 void addIterationLimitReachedEventListener(IterationLimitReachedEventListener listener)
          Adds a iteration limit reached event listener.
 void addLayer()
          Adds a single layer to the network.
 void addLayerEventListener(LayerEventListener listener)
          Adds a layer added event listener.
 void connect()
          Connect the network using the networks' architecture rule.
 Architecture getArchitecture()
          Get the value of architecture.
 boolean getConnected()
          Returns whether the network has been connected.
static boolean getDebug()
          Get the debug flag.
 double getError()
          Get the network error.
 double getErrorCriterion()
          Get the network errorCriterion.
 ErrorType getErrorType()
          Get the value of errorType.
 java.util.Vector getHiddenLayers()
          Gets the hidden layers for this network.
 Layer getInputLayer()
          Gets the input layer for this network.
 Layer getLayerAt(int position)
          Get a specific layer in the network..
 Layer getLayerForID(long lID)
          Get a specific layer identified by its ID.
 java.util.Vector getLayers()
          Gets all layers for this network.
 boolean getLearning()
          Get the learning flag.
 java.util.Vector getLearningOrder()
          Method declaration
 long getNextLayerID()
          Get ID for the next layer.
 Layer getOutputLayer()
          Gets the output layer for this network.
 TrainingElement getTrainingElement()
          Get the training element currently being worked on by the network.
 TrainingSet getTrainingSet()
          Get the training set to be worked on by the network.
 boolean getUseBias()
          get the flag for whether this network will use a bias.
 void insertLayer(int index, int layerSize, java.lang.String name)
          Inserts layer of the given size at a given position
 void insertRangeOfLayers(int fromIndex, int[] layerSize)
          Inserts range layers of the given size at a given position
 void iterate()
          Iterates the network once.
 void iterate(int iterations)
          Iterates the network for a specified number of iterations
 void iterateToCriterion()
          Iterates the network for a specified number of iterations
 void loadConfiguration(java.io.File networkFile)
          Creates a network by loading a configuration file.
 void loadConfiguration(java.lang.String networkFileName)
          Creates a network by loading a configuration file by name.
 void loadTrainingData(java.lang.String inputFileName, java.lang.String outputFileName)
          Loads the data from the specified file.
static void main(java.lang.String[] args)
          The 'main' of the network.
 void reconnect()
          Method declaration
 void removeCriterionReachedEventListener(CriterionReachedEventListener listener)
          Removes a criterion reached event listener.
 void removeIterationLimitReachedEventListener(IterationLimitReachedEventListener listener)
          Removes a iteration limit reached event listener.
 void removeLayer(int index)
          Removes layer at a given position
 void removeLayerEventListener(LayerEventListener listener)
          Removes a layer added event listener.
 void removeRangeOfLayers(int fromIndex, int toIndex)
           
 void setArchitecture(Architecture v)
          Set the value of architecture.
 void setConnected(boolean connected)
          Set the connected flag.
 void setDebug(boolean debug)
          Set the debug flag.
 void setError(double error)
          Set the network error.
 void setErrorCriterion(double errorCriterion)
          Set the network errorCriterion.
 void setErrorType(ErrorType v)
          Set the value of errorType.
 void setLayerAt(Layer layer, int position)
          Set a specific position in the network to be a specific layer.
 void setLayers(java.util.Vector layers)
          Sets all layers for this network.
 void setLearning(boolean learning)
          Set the learning flag.
 void setLearningOrder(java.util.Vector learningOrder)
          Method declaration
 void setNextLayerID(long lLID)
          Set ID for the next layer.
 void setSize(int i)
          Sets the size of this network.
 void setTrainingElement(TrainingElement trainingElement)
          Set the training element to be worked on by the network.
 void setTrainingSet(TrainingSet trainingSet)
          Set the training set to be worked on by the network.
 void setUseBias(boolean useBias)
          Set whether the network will use a bias.
 int size()
          Returns the layercount
 java.lang.String toString()
          Returns a string representation of the network useable for debug purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Network

public Network()
Constructor declaration


Network

public Network(java.lang.String networkFileName)
Constructor use to create a network from a configuration file.

Parameters:
networkFileName - Name of the file to load.
Method Detail

reconnect

public final void reconnect()
                     throws net.openai.ai.nn.network.NetworkConfigurationException
Method declaration

Throws:
NetworkConfigurationException
See Also:

loadConfiguration

public final void loadConfiguration(java.lang.String networkFileName)
                             throws net.openai.ai.nn.network.NetworkConfigurationException
Creates a network by loading a configuration file by name.

Parameters:
networkFileName - The name of the configuration file to load.
net.openai.ai.nn.network.NetworkConfigurationException

loadConfiguration

public final void loadConfiguration(java.io.File networkFile)
                             throws net.openai.ai.nn.network.NetworkConfigurationException
Creates a network by loading a configuration file.

Parameters:
networkFile - The configuration file to load.
net.openai.ai.nn.network.NetworkConfigurationException

loadTrainingData

public final void loadTrainingData(java.lang.String inputFileName,
                                   java.lang.String outputFileName)
Loads the data from the specified file.

Parameters:
inputFileName - The name of the input data file to load.
outputFileName - The name of the output data file to load.

iterate

public final void iterate(int iterations)
Iterates the network for a specified number of iterations

Parameters:
iterations - The number of times to iterate the network.

iterateToCriterion

public final void iterateToCriterion()
Iterates the network for a specified number of iterations


iterate

public final void iterate()
Iterates the network once.


getConnected

public final boolean getConnected()
Returns whether the network has been connected.

Returns:
boolean Whether the network is connected.

setConnected

public final void setConnected(boolean connected)
Set the connected flag.


connect

public final void connect()
                   throws net.openai.ai.nn.network.NetworkConfigurationException
Connect the network using the networks' architecture rule.

net.openai.ai.nn.network.NetworkConfigurationException

getLayers

public final java.util.Vector getLayers()
Gets all layers for this network.

Returns:
Vector All layers in this network.

setLayers

public final void setLayers(java.util.Vector layers)
Sets all layers for this network.

Parameters:
layers - The set of layers this network will operate on.

getInputLayer

public final Layer getInputLayer()
Gets the input layer for this network.

Returns:
Layer The first, or input layer, of this network.

getHiddenLayers

public final java.util.Vector getHiddenLayers()
Gets the hidden layers for this network.

Returns:
Vector All layers other than the input and output layer.

getOutputLayer

public final Layer getOutputLayer()
Gets the output layer for this network.

Returns:
Layer The last, or output layer, of this network.

setSize

public final void setSize(int i)
Sets the size of this network. (i.e. the number of layers) This should behave much like the Vector.setSize() in that, if i > current Size, new Layers are added to the network and if i < current Size then any Layer at index i or greater are discarded.

Parameters:
i - The number of layers to be held by this network.

addLayer

public void addLayer()
Adds a single layer to the network.


getLayerAt

public final Layer getLayerAt(int position)
Get a specific layer in the network..

Parameters:
position - The position in the network of the layer requested.
Returns:
Layer the layer at position.

getLayerForID

public final Layer getLayerForID(long lID)
Get a specific layer identified by its ID.

Parameters:
lID - ID of the layer
Returns:
Layer with given ID, NULL if the layer cant be found

setLayerAt

public final void setLayerAt(Layer layer,
                             int position)
Set a specific position in the network to be a specific layer.

Parameters:
position - The position in the network.
layer - The layer to be set at the specified position.

getLearning

public final boolean getLearning()
Get the learning flag.

Returns:
boolean Whether the network is in learning mode.

setLearning

public final void setLearning(boolean learning)
Set the learning flag.

Parameters:
learning - A boolean value which if true sets the network in learning mode.

getLearningOrder

public java.util.Vector getLearningOrder()
Method declaration

Returns:
See Also:

setLearningOrder

public void setLearningOrder(java.util.Vector learningOrder)
Method declaration

Parameters:
learningOrder -
See Also:

getErrorType

public final ErrorType getErrorType()
Get the value of errorType.

Returns:
Value of errorType.

setErrorType

public final void setErrorType(ErrorType v)
Set the value of errorType.

Parameters:
v - Value to assign to errorType.

getArchitecture

public final Architecture getArchitecture()
Get the value of architecture.

Returns:
Value of architecture.

setArchitecture

public final void setArchitecture(Architecture v)
Set the value of architecture.

Parameters:
v - Value to assign to architecture.

getTrainingSet

public final TrainingSet getTrainingSet()
Get the training set to be worked on by the network.

Returns:
TrainingSet The training set for the network.

setTrainingSet

public final void setTrainingSet(TrainingSet trainingSet)
Set the training set to be worked on by the network.

Parameters:
trainingSet - The training set for the network.

getTrainingElement

public final TrainingElement getTrainingElement()
Get the training element currently being worked on by the network.

Returns:
TrainingElement The current training element.

setTrainingElement

public final void setTrainingElement(TrainingElement trainingElement)
Set the training element to be worked on by the network.

Parameters:
trainingElement - The training element for the network.

getUseBias

public final boolean getUseBias()
get the flag for whether this network will use a bias.

Returns:
boolean Flag for using a bias.

setUseBias

public final void setUseBias(boolean useBias)
Set whether the network will use a bias.

Parameters:
useBias - Whether the network will use a bias.

getError

public final double getError()
Get the network error.

Returns:
double The error for the network.

setError

public final void setError(double error)
Set the network error.

Parameters:
error - The value of the network error.

getErrorCriterion

public final double getErrorCriterion()
Get the network errorCriterion.

Returns:
double The errorCriterion for the network.

setErrorCriterion

public final void setErrorCriterion(double errorCriterion)
Set the network errorCriterion.

Parameters:
errorCriterion - The value of the network errorCriterion.

getNextLayerID

public long getNextLayerID()
Get ID for the next layer. This method is important mostly for castor.

Returns:
long Next layer ID

setNextLayerID

public void setNextLayerID(long lLID)
Set ID for the next layer. This method is important mostly for castor.

Parameters:
lLID - The value of the ID.

getDebug

public static final boolean getDebug()
Get the debug flag.

Returns:
boolean Whether the network is in debug mode.

setDebug

public final void setDebug(boolean debug)
Set the debug flag.

Parameters:
debug - A boolean value which if true sets the network in debug mode.

addLayerEventListener

public void addLayerEventListener(LayerEventListener listener)
Adds a layer added event listener.

Parameters:
listener - listener to add.

removeLayerEventListener

public void removeLayerEventListener(LayerEventListener listener)
Removes a layer added event listener.

Parameters:
listener - listener to remove.

addIterationLimitReachedEventListener

public void addIterationLimitReachedEventListener(IterationLimitReachedEventListener listener)
Adds a iteration limit reached event listener.

Parameters:
listener - listener to add.

removeIterationLimitReachedEventListener

public void removeIterationLimitReachedEventListener(IterationLimitReachedEventListener listener)
Removes a iteration limit reached event listener.

Parameters:
listener - listener to remove.

addCriterionReachedEventListener

public void addCriterionReachedEventListener(CriterionReachedEventListener listener)
Adds a criterion reached event listener.

Parameters:
listener - listener to add.

removeCriterionReachedEventListener

public void removeCriterionReachedEventListener(CriterionReachedEventListener listener)
Removes a criterion reached event listener.

Parameters:
listener - listener to remove.

insertLayer

public void insertLayer(int index,
                        int layerSize,
                        java.lang.String name)
Inserts layer of the given size at a given position

Parameters:
index - position of layer insertion
layerSize - size of the layer being inserted

insertRangeOfLayers

public void insertRangeOfLayers(int fromIndex,
                                int[] layerSize)
Inserts range layers of the given size at a given position

Parameters:
fromIndex - position of the 1st layer to be inserted

removeLayer

public void removeLayer(int index)
Removes layer at a given position

Parameters:
index - position of a layer to be removed

removeRangeOfLayers

public void removeRangeOfLayers(int fromIndex,
                                int toIndex)

toString

public java.lang.String toString()
Returns a string representation of the network useable for debug purposes.

Overrides:
toString in class java.lang.Object
Returns:
String the String representation of this network object

main

public static void main(java.lang.String[] args)
The 'main' of the network.

Parameters:
args - Contains the network XML configuration file to load or name of the BSH script file.

size

public int size()
Returns the layercount



Copyright - 2001 OpenAI Labs. All Rights Reserved.