The Encog Project

org.encog.neural.networks.layers
Class FeedforwardLayer

java.lang.Object
  extended by org.encog.neural.networks.layers.BasicLayer
      extended by org.encog.neural.networks.layers.FeedforwardLayer
All Implemented Interfaces:
java.io.Serializable, Layer, EncogPersistedObject

public class FeedforwardLayer
extends BasicLayer
implements java.io.Serializable, EncogPersistedObject

FeedforwardLayer: This class represents one layer in a feed forward neural network. This layer could be input, output, or hidden, depending on its placement inside of the FeedforwardNetwork class. An activation function can also be specified. Usually all layers in a neural network will use the same activation function. By default this class uses the sigmoid activation function.

See Also:
Serialized Form

Constructor Summary
FeedforwardLayer(ActivationFunction thresholdFunction, int neuronCount)
          Construct this layer with a non-default threshold function.
FeedforwardLayer(int neuronCount)
          Construct this layer with a sigmoid threshold function.
 
Method Summary
 FeedforwardLayer cloneStructure()
          Clone the structure of this layer, but do not copy any matrix data.
 NeuralData compute(NeuralData pattern)
          Compute the outputs for this layer given the input pattern.
 ActivationFunction getActivationFunction()
           
 void prune(int neuron)
          Prune one of the neurons from this layer.
 void setMatrix(Matrix matrix)
          Assign a new weight and threshold matrix to this layer.
 void setNext(Layer next)
          Set the next layer.
 java.lang.String toString()
           
 
Methods inherited from class org.encog.neural.networks.layers.BasicLayer
getFire, getFire, getMatrix, getMatrixSize, getNeuronCount, getNext, getPrevious, hasMatrix, isHidden, isInput, isOutput, reset, setFire, setFire, setPrevious
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FeedforwardLayer

public FeedforwardLayer(ActivationFunction thresholdFunction,
                        int neuronCount)
Construct this layer with a non-default threshold function.

Parameters:
thresholdFunction - The threshold function to use.
neuronCount - How many neurons in this layer.

FeedforwardLayer

public FeedforwardLayer(int neuronCount)
Construct this layer with a sigmoid threshold function.

Parameters:
neuronCount - How many neurons in this layer.
Method Detail

cloneStructure

public FeedforwardLayer cloneStructure()
Clone the structure of this layer, but do not copy any matrix data.

Returns:
The cloned layer.

compute

public NeuralData compute(NeuralData pattern)
Compute the outputs for this layer given the input pattern. The output is also stored in the fire instance variable.

Specified by:
compute in interface Layer
Overrides:
compute in class BasicLayer
Parameters:
pattern - The input pattern.
Returns:
The output from this layer.

getActivationFunction

public ActivationFunction getActivationFunction()
Returns:
The activation function for this layer.

prune

public void prune(int neuron)
Prune one of the neurons from this layer. Remove all entries in this weight matrix and other layers.

Parameters:
neuron - The neuron to prune. Zero specifies the first neuron.

setMatrix

public void setMatrix(Matrix matrix)
Assign a new weight and threshold matrix to this layer.

Specified by:
setMatrix in interface Layer
Overrides:
setMatrix in class BasicLayer
Parameters:
matrix - The new matrix.

setNext

public void setNext(Layer next)
Set the next layer.

Specified by:
setNext in interface Layer
Overrides:
setNext in class BasicLayer
Parameters:
next - the next layer.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
The string form of the layer.

The Encog Project