org.joone.engine
Class ContextLayer

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

public class ContextLayer
extends SimpleLayer

The context layer is similar to the linear layer except that it has an auto-recurrent connection between its output and input. MG: Added ability to save and restore the initial state. Also changed so that initial state is used when first pattern is requested. TODO: Context neurons are usually used in the input layer of Jordan networks together with non-recursive neurons. So there are two questions: - how can this layer be combined with an non-recursive layer? - is there already a mechanism how to feed the network output back in the neurons of this layer?

Author:
P.Marrone
See Also:
Serialized Form

Field Summary
protected  Matrix initialState
          The initial state
 
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
ContextLayer()
           
ContextLayer(java.lang.String name)
           
 
Method Summary
 void backward(double[] pattern)
          Reverse transfer function of the component.
 void forward(double[] pattern)
          Transfer function to recall a result on a trained net
 double getBeta()
          Getter for property beta.
 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
 Matrix getInitialState()
          Get the initial state, also use this to change, in place, the initial state
 double getMaximumState()
          Return maximum value of a node in this layer
 double getMinimumState()
          Return minimum value of a node in this layer
 double getTimeConstant()
          Getter for property timeConstant.
 java.util.Collection Inspections()
          It doesn't make sense to return biases for this layer
 void resetInitialState()
          Reset the initial state of this context layer.
 void setBeta(double beta)
          Setter for property beta.
protected  void setDimensions()
          Use this to also allocate space for the initial state vector
 void setTimeConstant(double timeConstant)
          Setter for property timeConstant.
 
Methods inherited from class org.joone.engine.SimpleLayer
getLearningRate, getLrate, getMomentum, setLrate, setMomentum, setMonitor
 
Methods inherited from class org.joone.engine.Layer
addInputSynapse, addNoise, addOutputSynapse, adjustSizeToFwdPattern, adjustSizeToRevPattern, check, 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, start, stop, sumBackInput, sumInput, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

initialState

protected Matrix initialState
The initial state

Constructor Detail

ContextLayer

public ContextLayer()

ContextLayer

public ContextLayer(java.lang.String name)
Method Detail

backward

public void backward(double[] pattern)
Description copied from class: Layer
Reverse transfer function of the component.

Overrides:
backward in class SimpleLayer
Parameters:
pattern - input pattern on which to apply the transfer function

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)
Description copied from class: Layer
Transfer function to recall a result on a trained net

Specified by:
forward in class Layer
Parameters:
pattern - input pattern to which to apply the rtransfer function

getBeta

public double getBeta()
Getter for property beta.

Returns:
Value of property beta.

setBeta

public void setBeta(double beta)
Setter for property beta.

Parameters:
beta - New value of property beta.

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.

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

setDimensions

protected void setDimensions()
Use this to also allocate space for the initial state vector

Overrides:
setDimensions in class SimpleLayer

getInitialState

public Matrix getInitialState()
Get the initial state, also use this to change, in place, the initial state


resetInitialState

public void resetInitialState()
Reset the initial state of this context layer. This also reset all attached synapses and afterwards fires the initial state into them.


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