The Encog Project

org.encog.neural.networks.layers
Class BasicLayer

java.lang.Object
  extended by org.encog.neural.networks.layers.BasicLayer
All Implemented Interfaces:
Layer, EncogPersistedObject
Direct Known Subclasses:
FeedforwardLayer, HopfieldLayer, SOMLayer

public class BasicLayer
extends java.lang.Object
implements Layer, EncogPersistedObject

Basic functionality that most of the nueral layers require.

Author:
jheaton

Constructor Summary
BasicLayer(int neuronCount)
          Construct a basic layer with the specified neuron count.
 
Method Summary
 NeuralData compute(NeuralData pattern)
          This layer is too basic to know how to compute a pattern, it simply passes the pattern on.
 NeuralData getFire()
          Get the output array from the last time that the output of this layer was calculated.
 double getFire(int index)
          Get the output from an individual neuron.
 Matrix getMatrix()
          Get the weight and threshold matrix.
 int getMatrixSize()
          Get the size of the matrix, or zero if one is not defined.
 int getNeuronCount()
          Get the neuron count for this layer.
 Layer getNext()
           
 Layer getPrevious()
           
 boolean hasMatrix()
          Determine if this layer has a matrix.
 boolean isHidden()
          Determine if this is a hidden layer.
 boolean isInput()
          Determine if this is an input layer.
 boolean isOutput()
          Determine if this is an output layer.
 void reset()
          Reset the weight matrix and threshold values to random numbers between -1 and 1.
 void setFire(int index, double f)
          Set the last output value for the specified neuron.
 void setFire(NeuralData fire)
          Set the fire data.
 void setMatrix(Matrix matrix)
          Assign a new weight and threshold matrix to this layer.
 void setNext(Layer next)
          Set the next layer.
 void setPrevious(Layer previous)
          Set the previous layer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicLayer

public BasicLayer(int neuronCount)
Construct a basic layer with the specified neuron count.

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

compute

public NeuralData compute(NeuralData pattern)
This layer is too basic to know how to compute a pattern, it simply passes the pattern on.

Specified by:
compute in interface Layer
Parameters:
pattern - The pattern to compute against.
Returns:
The input pattern is returned.

getFire

public NeuralData getFire()
Get the output array from the last time that the output of this layer was calculated.

Specified by:
getFire in interface Layer
Returns:
The output array.

getFire

public double getFire(int index)
Get the output from an individual neuron.

Parameters:
index - The neuron specified.
Returns:
The output from the specified neuron.

getMatrix

public Matrix getMatrix()
Get the weight and threshold matrix.

Specified by:
getMatrix in interface Layer
Returns:
The weight and threshold matrix.

getMatrixSize

public int getMatrixSize()
Get the size of the matrix, or zero if one is not defined.

Specified by:
getMatrixSize in interface Layer
Returns:
The size of the matrix.

getNeuronCount

public int getNeuronCount()
Get the neuron count for this layer.

Specified by:
getNeuronCount in interface Layer
Returns:
the neuronCount

getNext

public Layer getNext()
Specified by:
getNext in interface Layer
Returns:
the next layer.

getPrevious

public Layer getPrevious()
Returns:
the previous layer.

hasMatrix

public boolean hasMatrix()
Determine if this layer has a matrix.

Specified by:
hasMatrix in interface Layer
Returns:
True if this layer has a matrix.

isHidden

public boolean isHidden()
Determine if this is a hidden layer.

Specified by:
isHidden in interface Layer
Returns:
True if this is a hidden layer.

isInput

public boolean isInput()
Determine if this is an input layer.

Specified by:
isInput in interface Layer
Returns:
True if this is an input layer.

isOutput

public boolean isOutput()
Determine if this is an output layer.

Specified by:
isOutput in interface Layer
Returns:
True if this is an output layer.

reset

public void reset()
Reset the weight matrix and threshold values to random numbers between -1 and 1.

Specified by:
reset in interface Layer

setFire

public void setFire(int index,
                    double f)
Set the last output value for the specified neuron.

Specified by:
setFire in interface Layer
Parameters:
index - The specified neuron.
f - The fire value for the specified neuron.

setFire

public void setFire(NeuralData fire)
Set the fire data.

Specified by:
setFire in interface Layer
Parameters:
fire - The fire data.

setMatrix

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

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

setNext

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

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

setPrevious

public void setPrevious(Layer previous)
Set the previous layer.

Specified by:
setPrevious in interface Layer
Parameters:
previous - the previous layer.

The Encog Project