org.joone.net
Class NestedNeuralLayer

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

public class NestedNeuralLayer
extends Layer

See Also:
Serialized Form

Field Summary
(package private) static long serialVersionUID
           
 
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
NestedNeuralLayer()
           
NestedNeuralLayer(java.lang.String elemName)
           
 
Method Summary
 boolean addInputSynapse(InputPatternListener p1)
          Adds a new input synapse to the layer
 void addNoise(double p1)
          Adds a noise componentto the biases of the layer and to all the input connected synapses.
 boolean addOutputSynapse(OutputPatternListener p1)
          Adds a new output synapse to the layer
protected  void backward(double[] pattern)
          Reverse transfer function of the component.
 java.util.TreeSet check()
          Get check messages from listeners.
 NeuralLayer copyInto(NeuralLayer p1)
          Copies one layer into another, to obtain a type-transformation from one kind of Layer to another.
protected  void forward(double[] pattern)
          Transfer function to recall a result on a trained net
 void fwdRun(Pattern pattIn)
          Implementation code for the single-thread version of Joone.
 java.util.Vector getAllInputs()
          Returns the vector of the input listeners
 java.util.Vector getAllOutputs()
          Returns the vector of the output listeners
 Matrix getBias()
          Return the bias matrix
 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
 java.io.File getEmbeddedNet()
           
 java.lang.String getLayerName()
          Returns the name of the layer
 double getMaximumState()
          Return maximum value of a node in this layer
 double getMinimumState()
          Return minimum value of a node in this layer
 Monitor getMonitor()
          Returns the monitor object
 NeuralNet getNestedNeuralNet()
          Getter for property NestedNeuralNet.
 java.lang.String getNeuralNet()
           
 int getRows()
          Returns the dimension (# of neurons) of the Layer
 boolean isLearning()
          Getter for property learning.
 boolean isRunning()
          Determine whether the execution thread is running
 void randomize(double amplitude)
          Initialize the weights of the biases and of all the connected synapses WARNING: amplitude parameter is ignored when elements are using WeightInitializer other than RandomWeightInitializer
 void removeAllInputs()
          Remove all the input listeners of the layer
 void removeAllOutputs()
          Remove all the output listeners of the layer
 void removeInputSynapse(InputPatternListener p1)
          Remove an input Listener
 void removeOutputSynapse(OutputPatternListener p1)
          Remove an output listener from the layer
 void revRun(Pattern pattIn)
          This method serves to a single backward step when the Layer is called from an external thread
 void setAllInputs(java.util.Vector p1)
          Sets the Vector that contains all the input listeners.
 void setAllOutputs(java.util.Vector p1)
          Sets the Vector that contains all the output listeners.
 void setBias(Matrix p1)
          Sets the matrix of biases
protected  void setDimensions()
          Sets the dimension of the layer.
 void setEmbeddedNet(java.io.File embeddedNet)
           
 void setLayerName(java.lang.String p1)
          Sets the name of the layer
 void setLearning(boolean learning)
          Setter for property learning.
 void setMonitor(Monitor p1)
          Sets the monitor object
 void setNestedNeuralNet(NeuralNet newNeuralNet)
          Setter for property NestedNeuralNet.
 void setNeuralNet(java.lang.String NNFile)
           
 void setRows(int p1)
          Sets the dimension (# of neurons) of the Layer
 void start()
          Starts the Layer
 void stop()
          Stops the Layer
 
Methods inherited from class org.joone.engine.Layer
adjustSizeToFwdPattern, adjustSizeToRevPattern, checkInputEnabled, checkInputs, checkOutputs, finalize, fireFwdGet, fireFwdPut, fireRevGet, fireRevPut, getDimension, getLastGradientInps, getLastGradientOuts, getLastInputs, getLastOutputs, getLearner, getThreadMonitor, hasStepCounter, init, initLearner, InspectableTitle, Inspections, isInputLayer, isOutputLayer, join, randomizeBias, randomizeWeights, removeListener, resetInputListeners, run, setConnDimensions, setInputDimension, setInputSynapses, setLastInputs, setLastOutputs, setOutputDimension, setOutputSynapses, sumBackInput, sumInput, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

NestedNeuralLayer

public NestedNeuralLayer()

NestedNeuralLayer

public NestedNeuralLayer(java.lang.String elemName)
Method Detail

setDimensions

protected void setDimensions()
Description copied from class: Layer
Sets the dimension of the layer. Override to define how the internal buffers must be sized.

Specified by:
setDimensions in class Layer

forward

protected 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

backward

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

Specified by:
backward in class Layer
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

getNeuralNet

public java.lang.String getNeuralNet()

setNeuralNet

public void setNeuralNet(java.lang.String NNFile)

start

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

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

stop

public void stop()
Description copied from class: Layer
Stops the Layer

Overrides:
stop in class Layer

getRows

public int getRows()
Description copied from class: Layer
Returns the dimension (# of neurons) of the Layer

Specified by:
getRows in interface NeuralLayer
Overrides:
getRows in class Layer
Returns:
the number of neurons in the layer

setRows

public void setRows(int p1)
Description copied from class: Layer
Sets the dimension (# of neurons) of the Layer

Specified by:
setRows in interface NeuralLayer
Overrides:
setRows in class Layer
Parameters:
p1 - The number of the neurons contained in the Layer

addNoise

public void addNoise(double p1)
Description copied from class: Layer
Adds a noise componentto the biases of the layer and to all the input connected synapses.

Specified by:
addNoise in interface NeuralLayer
Overrides:
addNoise in class Layer
Parameters:
p1 - the noise's amplitude in terms of distance from zero; e.g. a value equal 0.3 means a noise range from -0.3 to 0.3

randomize

public void randomize(double amplitude)
Description copied from class: Layer
Initialize the weights of the biases and of all the connected synapses WARNING: amplitude parameter is ignored when elements are using WeightInitializer other than RandomWeightInitializer

Overrides:
randomize in class Layer
Parameters:
amplitude - the amplitude of uniformly generated random weights

getBias

public Matrix getBias()
Description copied from class: Layer
Return the bias matrix

Specified by:
getBias in interface NeuralLayer
Overrides:
getBias in class Layer
Returns:
the layer biases

getAllOutputs

public java.util.Vector getAllOutputs()
Description copied from class: Layer
Returns the vector of the output listeners

Specified by:
getAllOutputs in interface NeuralLayer
Overrides:
getAllOutputs in class Layer
Returns:
the connected output pattern listeners

getLayerName

public java.lang.String getLayerName()
Description copied from class: Layer
Returns the name of the layer

Specified by:
getLayerName in interface NeuralLayer
Overrides:
getLayerName in class Layer
Returns:
the name of the layer

removeOutputSynapse

public void removeOutputSynapse(OutputPatternListener p1)
Description copied from class: Layer
Remove an output listener from the layer

Specified by:
removeOutputSynapse in interface NeuralLayer
Overrides:
removeOutputSynapse in class Layer
Parameters:
p1 - the output listener to remove

setAllInputs

public void setAllInputs(java.util.Vector p1)
Description copied from class: Layer
Sets the Vector that contains all the input listeners. Can be useful to set the input synapses taken from another Layer

Specified by:
setAllInputs in interface NeuralLayer
Overrides:
setAllInputs in class Layer
Parameters:
p1 - The vector containing the list of input synapses

removeAllOutputs

public void removeAllOutputs()
Description copied from class: Layer
Remove all the output listeners of the layer

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

getAllInputs

public java.util.Vector getAllInputs()
Description copied from class: Layer
Returns the vector of the input listeners

Specified by:
getAllInputs in interface NeuralLayer
Overrides:
getAllInputs in class Layer
Returns:
the connected input pattern listeners

addOutputSynapse

public boolean addOutputSynapse(OutputPatternListener p1)
Description copied from class: Layer
Adds a new output synapse to the layer

Specified by:
addOutputSynapse in interface NeuralLayer
Overrides:
addOutputSynapse in class Layer
Parameters:
p1 - The new output synapse
Returns:
whether the listener was added

setBias

public void setBias(Matrix p1)
Description copied from class: Layer
Sets the matrix of biases

Specified by:
setBias in interface NeuralLayer
Overrides:
setBias in class Layer
Parameters:
p1 - The Matrix object containing the biases

removeInputSynapse

public void removeInputSynapse(InputPatternListener p1)
Description copied from class: Layer
Remove an input Listener

Specified by:
removeInputSynapse in interface NeuralLayer
Overrides:
removeInputSynapse in class Layer
Parameters:
p1 - the input listener to remove

setLayerName

public void setLayerName(java.lang.String p1)
Description copied from class: Layer
Sets the name of the layer

Specified by:
setLayerName in interface NeuralLayer
Overrides:
setLayerName in class Layer
Parameters:
p1 - The name

addInputSynapse

public boolean addInputSynapse(InputPatternListener p1)
Description copied from class: Layer
Adds a new input synapse to the layer

Specified by:
addInputSynapse in interface NeuralLayer
Overrides:
addInputSynapse in class Layer
Parameters:
p1 - The new input synapse to add
Returns:
whether the listener was added

setAllOutputs

public void setAllOutputs(java.util.Vector p1)
Description copied from class: Layer
Sets the Vector that contains all the output listeners. Can be useful to set the output synapses taken from another Layer

Specified by:
setAllOutputs in interface NeuralLayer
Overrides:
setAllOutputs in class Layer
Parameters:
p1 - The vector containing the list of output synapses

setMonitor

public void setMonitor(Monitor p1)
Description copied from class: Layer
Sets the monitor object

Specified by:
setMonitor in interface NeuralLayer
Overrides:
setMonitor in class Layer
Parameters:
p1 - The Monitor

getMonitor

public Monitor getMonitor()
Description copied from class: Layer
Returns the monitor object

Specified by:
getMonitor in interface Learnable
Specified by:
getMonitor in interface NeuralLayer
Overrides:
getMonitor in class Layer
Returns:
the layer's Monitor object

removeAllInputs

public void removeAllInputs()
Description copied from class: Layer
Remove all the input listeners of the layer

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

copyInto

public NeuralLayer copyInto(NeuralLayer p1)
Description copied from class: Layer
Copies one layer into another, to obtain a type-transformation from one kind of Layer to another. The old Layer is disconnected from the net, and the new Layer takes its place.

Specified by:
copyInto in interface NeuralLayer
Overrides:
copyInto in class Layer
Parameters:
p1 - the new layer with which to replace this one
Returns:
The new layer

isRunning

public boolean isRunning()
Description copied from class: Layer
Determine whether the execution thread is running

Specified by:
isRunning in interface NeuralLayer
Overrides:
isRunning in class Layer
Returns:
whether it is running

getNestedNeuralNet

public NeuralNet getNestedNeuralNet()
Getter for property NestedNeuralNet.

Returns:
Value of property NestedNeuralNet.

setNestedNeuralNet

public void setNestedNeuralNet(NeuralNet newNeuralNet)
Setter for property NestedNeuralNet.

Parameters:
NestedNeuralNet - New value of property NestedNeuralNet.

isLearning

public boolean isLearning()
Getter for property learning.

Returns:
Value of property learning.

setLearning

public void setLearning(boolean learning)
Setter for property learning.

Parameters:
learning - New value of property learning.

check

public java.util.TreeSet check()
Description copied from class: Layer
Get check messages from listeners. Subclasses should call this method from thier own check method.

Specified by:
check in interface NeuralLayer
Overrides:
check in class Layer
Returns:
validation errors.
See Also:
NeuralLayer

getEmbeddedNet

public java.io.File getEmbeddedNet()

setEmbeddedNet

public void setEmbeddedNet(java.io.File embeddedNet)

fwdRun

public void fwdRun(Pattern pattIn)
Description copied from class: Layer
Implementation code for the single-thread version of Joone. This method serves to a single forward step when the Layer is called from an external thread.

Overrides:
fwdRun in class Layer

revRun

public void revRun(Pattern pattIn)
Description copied from class: Layer
This method serves to a single backward step when the Layer is called from an external thread

Overrides:
revRun in class Layer

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