bsoc.nn
Class Net

java.lang.Object
  |
  +--bsoc.nn.Net

public class Net
extends java.lang.Object
implements java.io.Serializable, bsoc.nn.ToBeConnectedInterface, Crossable

Is an artificiel neural net.

A net contains out of an ordered list of layers. The first layer is called the input-layer and the last layer is the output layer. The layers are lists of layer-nodes. A layer-node is a neuron if it is not in the input layer. Connections between neurons and layer-nodes can be defined via synapses. The structure (its connections) of the net is defined by the net-connector that must be used as an argumet to the constructor. Diverse parameters for synapses and neurons can also be defined with the net-Connector.

see@ Neuron see@ Layer

See Also:
Serialized Form

Constructor Summary
Net(NetConnector nc)
           
 
Method Summary
 void addLayer(Layer l)
           
 boolean equals(java.lang.Object o)
          Compares the weights and values of two nets.
 boolean equalsInValues(java.lang.Object o)
          Compares the values of the layer-nodes (or neurons) of two nets.
 boolean equalsInWeights(java.lang.Object o)
          Compares the weights of the synapses of two nets.
 Layer getInputLayer()
           
 bsoc.nn.NeuronLayer getOutputLayer()
           
 Layer layerAt(int i)
           
 int layerCount()
           
 java.util.Enumeration layers()
          Iterates through the layers of the net.
 java.util.Enumeration neuronLayers()
          Iterates through the layers containing neurons.
 Crossable newChild(Crossable otherParent, CrossoverSwitch cs, Mutator mut)
          Creates a child net.
 void recalculate()
           
 void setInputLayerValuesRandom(RandomValue rv)
           
 void setWeightsCrossover(Net father, Net mother, java.util.Random r)
          Sets the weights of the net according to the weights of the parent nets by means of an n-point crossover algorithm.
 void setWeightsRandom()
           
 void setWeightsRandom(RandomWgt rw)
           
 java.lang.String toString()
           
 void writeConnStatToStream(java.io.PrintWriter str)
          Writes a connection statistic to an output stream.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Net

public Net(NetConnector nc)
Method Detail

getOutputLayer

public bsoc.nn.NeuronLayer getOutputLayer()

getInputLayer

public Layer getInputLayer()

newChild

public Crossable newChild(Crossable otherParent,
                          CrossoverSwitch cs,
                          Mutator mut)
Creates a child net. The structure is taken from this net. The weights are set by n-point crossover. Mutation is controlled by a mutator.
Specified by:
newChild in interface Crossable

setInputLayerValuesRandom

public void setInputLayerValuesRandom(RandomValue rv)

setWeightsRandom

public void setWeightsRandom(RandomWgt rw)

setWeightsRandom

public void setWeightsRandom()

setWeightsCrossover

public void setWeightsCrossover(Net father,
                                Net mother,
                                java.util.Random r)
Sets the weights of the net according to the weights of the parent nets by means of an n-point crossover algorithm.

addLayer

public void addLayer(Layer l)
Specified by:
addLayer in interface bsoc.nn.ToBeConnectedInterface

layerAt

public Layer layerAt(int i)
Specified by:
layerAt in interface bsoc.nn.ToBeConnectedInterface

layerCount

public int layerCount()
Specified by:
layerCount in interface bsoc.nn.ToBeConnectedInterface

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

writeConnStatToStream

public void writeConnStatToStream(java.io.PrintWriter str)
Writes a connection statistic to an output stream. This stream can be used to visualize the structure of the net.

The output stream is a table who's colums are delimited by semicolums. The first line contains columheaders.


recalculate

public void recalculate()

equalsInValues

public boolean equalsInValues(java.lang.Object o)
Compares the values of the layer-nodes (or neurons) of two nets. Can be used for testing

equalsInWeights

public boolean equalsInWeights(java.lang.Object o)
Compares the weights of the synapses of two nets. Can be used for testing

equals

public boolean equals(java.lang.Object o)
Compares the weights and values of two nets. Can be used for testing
Overrides:
equals in class java.lang.Object

layers

public java.util.Enumeration layers()
Iterates through the layers of the net. Returns layers.

neuronLayers

public java.util.Enumeration neuronLayers()
Iterates through the layers containing neurons. This are all layers except the input layer. Returns Layers.