org.jscience.computing.ai.neurocomputing
Class FFNLayer

java.lang.Object
  extended by org.jscience.computing.ai.neurocomputing.FFNLayer
Direct Known Subclasses:
FFNHiddenLayer, FFNInputLayer, FFNOutputLayer

public abstract class FFNLayer
extends java.lang.Object

An abstract class for the feedforward layers.


Field Summary
protected  Activation activate
          The activation function this layer uses.
protected  FFNLayer connected
          The next layer that this layer is connected to.
protected  FeedForwardNN myNetwork
          The network this layer belongs to.
protected  double[] outputs
          The outputs for this layer.
protected  double[][] weights
          The weights for this layer.
 
Constructor Summary
FFNLayer()
          Creates a new instance of FFNLayer
 
Method Summary
 void connectWith(FFNLayer connect)
          Connects this layer with another layer.
 double[] getOutput()
          Retrieve the outputs for this layer.
abstract  int getUnitCount()
          Get the number of units in this layer.
 void randomizeWeights(double min, double max)
          Randomize the weights between the given range.
 void run(double[] input)
          Run this layer on the given inputs.
 void setNetwork(FeedForwardNN network)
          Set the network for this layer.
 void setWeights(double[][] newWeights)
          Set the weights for this layer.
 void setWeights(int unit, double[] newWeights)
          Set the weights for a given units.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outputs

protected double[] outputs
The outputs for this layer.


weights

protected double[][] weights
The weights for this layer.


connected

protected FFNLayer connected
The next layer that this layer is connected to.


myNetwork

protected FeedForwardNN myNetwork
The network this layer belongs to.


activate

protected Activation activate
The activation function this layer uses.

Constructor Detail

FFNLayer

public FFNLayer()
Creates a new instance of FFNLayer

Method Detail

setNetwork

public void setNetwork(FeedForwardNN network)
Set the network for this layer.

Parameters:
network - the network to be used.

connectWith

public void connectWith(FFNLayer connect)
Connects this layer with another layer. This method is should normally only be called FeedForwardNN.initialize.

Parameters:
connect - the connecting layer.
See Also:
FeedForwardNN.initialize()

setWeights

public void setWeights(double[][] newWeights)
Set the weights for this layer. This method iteratively calls: for (int u=0; u

Parameters:
newWeights - the new weights.

setWeights

public void setWeights(int unit,
                       double[] newWeights)
Set the weights for a given units.

Parameters:
unit - the unit to set the weights for.
newWeights - the new weight array.

randomizeWeights

public void randomizeWeights(double min,
                             double max)
Randomize the weights between the given range.

Parameters:
min - the range minimum.
max - the range maximum.

getUnitCount

public abstract int getUnitCount()
Get the number of units in this layer.

Returns:
the number of units.

getOutput

public double[] getOutput()
Retrieve the outputs for this layer.

Returns:
the layer output.

run

public void run(double[] input)
         throws NeuralNetworkException
Run this layer on the given inputs.

Parameters:
input - the inputs for this layer.
Throws:
NeuralNetworkException - unused.