org.joone.engine
Class GaussianLayer

java.lang.Object
  extended by org.joone.engine.Layer
      extended by org.joone.engine.SimpleLayer
          extended by org.joone.engine.GaussianLayer
All Implemented Interfaces:
java.io.Serializable, java.lang.Runnable, java.util.EventListener, Learnable, LearnableLayer, NeuralLayer, NeuralNetListener, Inspectable

public class GaussianLayer
extends SimpleLayer
implements NeuralNetListener

This layer implements the Gaussian Neighborhood SOM strategy. It receives the euclidean distances between the input vector and weights and calculates the distance fall off between the winning node and all other nodes. These are passed back allowing the previous synapse to adjust it's weights.

The distance fall off is calculated according to a Gaussian distribution from the winning node. This layer uses implemtations of SpatialMap in order to calculate these distances. Currently this layer uses the GaussianSpatialMap which calculates the Gaussian distance for all nodes in the SOM map. Future maps will allow distance calculations based on a specific shape such as a circle , square or diamond. Currently the GuassianLayer supports 3D SOM maps.

See Also:
parent, Serialized Form

Field Summary
 
Fields inherited from class org.joone.engine.Layer
bias, gradientInps, gradientOuts, inps, inputPatternListeners, learnable, learning, m_batch, monitor, myLearner, outputPatternListeners, outs, running, step, STOP_FLAG
 
Constructor Summary
GaussianLayer()
          The default constructor for this GaussianLayer.
GaussianLayer(java.lang.String ElemName)
          The constructor that takes a name of the layer.
 
Method Summary
 void backward(double[] pattern)
          This method has a blank body as there are no biases to adjust.
 java.util.TreeSet check()
          Check that there are no errors or problems with the properties of this GaussianLayer.
 void cicleTerminated(NeuralNetEvent e)
          Updates the Gaussian Size if in learning mode.
 void errorChanged(NeuralNetEvent e)
           
 void forward(double[] pattern)
          This method takes as input an array of euclidean distances between the input and weights calculated by the previous synapse.
 double getDefaultState()
          Return the default state of a node in this layer, such as 0 for a tanh or 0.5 for a sigmoid layer
 double getDerivative(int i)
          Similar to the backward message and used by RTRL
 double getInitialGaussianSize()
          Getter for property initialGaussianSize.
 int getLargestDimension()
          Gets the largest layer dimension size.
 int getLayerDepth()
          Getter for property LayerDepth.
 int getLayerHeight()
          Getter for property LayerHeight.
 int getLayerWidth()
          Getter for property LayerWidth.
 double getMaximumState()
          Return maximum value of a node in this layer
 double getMinimumState()
          Return minimum value of a node in this layer
 int getOrderingPhase()
          Getter for property orderingPhase.
protected  SpatialMap getSpace_map()
          Getter for property space_map.
 double getTimeConstant()
          Getter for property timeConstant.
 java.util.Collection Inspections()
          It doesn't make sense to return biases for this layer
 void netStarted(NeuralNetEvent e)
          Initialises the time constant used to decrease the size of the spatial map.
 void netStopped(NeuralNetEvent e)
           
 void netStoppedError(NeuralNetEvent e, java.lang.String error)
           
 void setInitialGaussianSize(double initialGaussianSize)
          Setter for property initialGaussianSize.
 void setLayerDepth(int layerDepth)
          Setter for property LayerDepth.
 void setLayerHeight(int LayerHeight)
          Setter for property LayerHeight.
 void setLayerWidth(int LayerWidth)
          Setter for property LayerWidth.
 void setOrderingPhase(int orderingPhase)
          Setter for property orderingPhase.
 void setTimeConstant(double timeConstant)
          Setter for property timeConstant.
 void start()
          Starts the Layer
 
Methods inherited from class org.joone.engine.SimpleLayer
getLearningRate, getLrate, getMomentum, setDimensions, setLrate, setMomentum, setMonitor
 
Methods inherited from class org.joone.engine.Layer
addInputSynapse, addNoise, addOutputSynapse, adjustSizeToFwdPattern, adjustSizeToRevPattern, checkInputEnabled, checkInputs, checkOutputs, copyInto, finalize, fireFwdGet, fireFwdPut, fireRevGet, fireRevPut, fwdRun, getAllInputs, getAllOutputs, getBias, getDimension, getLastGradientInps, getLastGradientOuts, getLastInputs, getLastOutputs, getLayerName, getLearner, getMonitor, getRows, getThreadMonitor, hasStepCounter, init, initLearner, InspectableTitle, isInputLayer, isOutputLayer, isRunning, join, randomize, randomizeBias, randomizeWeights, removeAllInputs, removeAllOutputs, removeInputSynapse, removeListener, removeOutputSynapse, resetInputListeners, revRun, run, setAllInputs, setAllOutputs, setBias, setConnDimensions, setInputDimension, setInputSynapses, setLastInputs, setLastOutputs, setLayerName, setOutputDimension, setOutputSynapses, setRows, stop, sumBackInput, sumInput, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GaussianLayer

public GaussianLayer()

The default constructor for this GaussianLayer.


GaussianLayer

public GaussianLayer(java.lang.String ElemName)
The constructor that takes a name of the layer.

Parameters:
ElemName - The name of the Layer
Method Detail

backward

public void backward(double[] pattern)
              throws JooneRuntimeException

This method has a blank body as there are no biases to adjust.

Overrides:
backward in class SimpleLayer
Parameters:
pattern - Not used. The pattern to process and pass back.
Throws:
JooneRuntimeException - The run time exception.

getDerivative

public double getDerivative(int i)
Similar to the backward message and used by RTRL

Specified by:
getDerivative in class Layer

forward

public void forward(double[] pattern)
             throws JooneRuntimeException

This method takes as input an array of euclidean distances between the input and weights calculated by the previous synapse. This method calculates the Gaussian distance fall off between the winning neuron and all other nodes. These distances are passed on to the next synapse.

Specified by:
forward in class Layer
Parameters:
pattern - The pattern containing the euclidean distances from the previous synapse.
Throws:
JooneRuntimeException - This Exception is a wrapper Exception when an Exception is thrown while doing the maths.
See Also:
(double[])

getLayerDepth

public int getLayerDepth()
Getter for property LayerDepth.

Returns:
Value of property LayerDepth.

setLayerDepth

public void setLayerDepth(int layerDepth)
Setter for property LayerDepth.

Parameters:
layerDepth - New value of property LayerDepth.

getLayerHeight

public int getLayerHeight()
Getter for property LayerHeight.

Returns:
Value of property LayerHeight.

setLayerHeight

public void setLayerHeight(int LayerHeight)
Setter for property LayerHeight.

Parameters:
LayerHeight - New value of property LayerHeight.

getLayerWidth

public int getLayerWidth()
Getter for property LayerWidth.

Returns:
Value of property LayerWidth.

setLayerWidth

public void setLayerWidth(int LayerWidth)
Setter for property LayerWidth.

Parameters:
LayerWidth - New value of property LayerWidth.

getLargestDimension

public int getLargestDimension()
Gets the largest layer dimension size.

Returns:
The size of the largest dimension, width , height or depth.

check

public java.util.TreeSet check()

Check that there are no errors or problems with the properties of this GaussianLayer.

Specified by:
check in interface NeuralLayer
Overrides:
check in class Layer
Returns:
The TreeSet of errors / problems if any.
See Also:
NeuralLayer

start

public void start()
Description copied from class: Layer
Starts the Layer

Specified by:
start in interface NeuralLayer
Overrides:
start in class Layer

netStarted

public void netStarted(NeuralNetEvent e)

Initialises the time constant used to decrease the size of the spatial map.

Specified by:
netStarted in interface NeuralNetListener
Parameters:
e - The original Net Event.

cicleTerminated

public void cicleTerminated(NeuralNetEvent e)

Updates the Gaussian Size if in learning mode.

Specified by:
cicleTerminated in interface NeuralNetListener
Parameters:
e - The original Net Event.

getOrderingPhase

public int getOrderingPhase()
Getter for property orderingPhase.

Returns:
Value of property orderingPhase.

setOrderingPhase

public void setOrderingPhase(int orderingPhase)
Setter for property orderingPhase.

Parameters:
orderingPhase - New value of property orderingPhase.

getTimeConstant

public double getTimeConstant()
Getter for property timeConstant.

Returns:
Value of property timeConstant.

setTimeConstant

public void setTimeConstant(double timeConstant)
Setter for property timeConstant.

Parameters:
timeConstant - New value of property timeConstant.

getSpace_map

protected SpatialMap getSpace_map()
Getter for property space_map.

Returns:
Value of property space_map.

getInitialGaussianSize

public double getInitialGaussianSize()
Getter for property initialGaussianSize.

Returns:
Value of property initialGaussianSize.

setInitialGaussianSize

public void setInitialGaussianSize(double initialGaussianSize)
Setter for property initialGaussianSize.

Parameters:
initialGaussianSize - New value of property initialGaussianSize.

Inspections

public java.util.Collection Inspections()
It doesn't make sense to return biases for this layer

Specified by:
Inspections in interface Inspectable
Overrides:
Inspections in class Layer
Returns:
null
See Also:
org.joone.Inspection

netStoppedError

public void netStoppedError(NeuralNetEvent e,
                            java.lang.String error)
Specified by:
netStoppedError in interface NeuralNetListener

errorChanged

public void errorChanged(NeuralNetEvent e)
Specified by:
errorChanged in interface NeuralNetListener

netStopped

public void netStopped(NeuralNetEvent e)
Specified by:
netStopped in interface NeuralNetListener

getDefaultState

public double getDefaultState()
Description copied from class: Layer
Return the default state of a node in this layer, such as 0 for a tanh or 0.5 for a sigmoid layer

Specified by:
getDefaultState in class Layer

getMinimumState

public double getMinimumState()
Description copied from class: Layer
Return minimum value of a node in this layer

Specified by:
getMinimumState in class Layer

getMaximumState

public double getMaximumState()
Description copied from class: Layer
Return maximum value of a node in this layer

Specified by:
getMaximumState in class Layer


Submit Feedback to pmarrone@users.sourceforge.net