de.htwdd.rosenkoenig.neuro.net
Class Layer

java.lang.Object
  extended by de.htwdd.rosenkoenig.neuro.net.Layer
Direct Known Subclasses:
InnerLayer, InputLayer

public abstract class Layer
extends java.lang.Object

This abstract class is the base class for the layers used in this project.


Field Summary
protected  ActivationFunction activationFunction
          The activation function of the net.
protected  boolean biased
          This determines whether the layer is biased or not.
protected  double[] nettoInput
          An array to remember the netto input.
protected  int neuronsThatAreNotBiasedCount
          This speakingly named variable gives us the number of neurons in a layer that are not biased.
protected  double[] output
          This array of doubles contains the outupt of this layer.
protected  Synapse outputSynapse
          This is the output synapse (i.e the connection to the next layer).
 
Constructor Summary
Layer()
          Default Ctor.
Layer(int numNeurons, boolean biased)
          Ctor that creates a layer with numNeurons that is biased or not.
Layer(int numNeurons, boolean biased, ActivationFunction activationFunction)
          Ctor that creates a layer with numNeurons that is biased or not.
 
Method Summary
 ActivationFunction getActivationFunction()
          Getter of the property activationFunction
 double[] getNettoInput()
          Getter of the property nettoInput
 int getNeuronsThatAreNotBiasedCount()
          Getter of the property offset
 double[] getOutput()
          Getter of the property output
 Synapse getOutputSynapse()
          Getter of the property outputSynapse
 int getSize()
           
 boolean isBiased()
          Return whether this layer is biased or not.
abstract  void propagate()
          The propagate function must be implemented by every layer.
 void setActivationFunction(ActivationFunction activationFunction)
          Setter of the property activationFunction
 void setBiased(boolean biased)
          Set the biased state of the layer.
 void setOutputSynapse(Synapse outputSynapse)
          Setter of the property outputSynapse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

biased

protected boolean biased
This determines whether the layer is biased or not.


activationFunction

protected ActivationFunction activationFunction
The activation function of the net. It is initialized with the Identity function by default.


nettoInput

protected double[] nettoInput
An array to remember the netto input.


output

protected double[] output
This array of doubles contains the outupt of this layer.


outputSynapse

protected Synapse outputSynapse
This is the output synapse (i.e the connection to the next layer).


neuronsThatAreNotBiasedCount

protected int neuronsThatAreNotBiasedCount
This speakingly named variable gives us the number of neurons in a layer that are not biased. If the layer is unbiased, this value contains the number of neurons, otherwise number of neurons -1. The name of the variable is intended to make you laugh!

Constructor Detail

Layer

public Layer()
Default Ctor. Does nothing, but is required? for reflection.


Layer

public Layer(int numNeurons,
             boolean biased)
Ctor that creates a layer with numNeurons that is biased or not. The activation function remains the identity function.

Parameters:
numNeurons - the number of neurons for this layer
biased - whether or not this layer is a biased one

Layer

public Layer(int numNeurons,
             boolean biased,
             ActivationFunction activationFunction)
Ctor that creates a layer with numNeurons that is biased or not. The activation function remains will be set to the activation function you specify.

Parameters:
numNeurons - the number of neurons for this layer
biased - whether or not this layer is a biased one
Method Detail

propagate

public abstract void propagate()
The propagate function must be implemented by every layer. It is used to propagate patterns through a net.


setBiased

public void setBiased(boolean biased)
Set the biased state of the layer.


getActivationFunction

public ActivationFunction getActivationFunction()
Getter of the property activationFunction

Returns:
Returns the activationFunction.

setActivationFunction

public void setActivationFunction(ActivationFunction activationFunction)
Setter of the property activationFunction

Parameters:
activationFunction - The activationFunction to set.

getNettoInput

public double[] getNettoInput()
Getter of the property nettoInput

Returns:
Returns the nettoInputs.

getOutput

public double[] getOutput()
Getter of the property output

Returns:
Returns the outputs.

getNeuronsThatAreNotBiasedCount

public int getNeuronsThatAreNotBiasedCount()
Getter of the property offset

Returns:
Returns the offset.

getOutputSynapse

public Synapse getOutputSynapse()
Getter of the property outputSynapse

Returns:
Returns the outputSynapse.

setOutputSynapse

public void setOutputSynapse(Synapse outputSynapse)
Setter of the property outputSynapse

Parameters:
outputSynapse - The outputSynapse to set.

getSize

public int getSize()
Returns:
the number of output values

isBiased

public boolean isBiased()
Return whether this layer is biased or not.