Documentation of 'org.joone.engine.Layer' Java class
Layer
org.joone.engine

Class Layer

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Runnable, Learnable, LearnableLayer, NeuralLayer, Inspectable
    Direct Known Subclasses:
    MemoryLayer, NestedNeuralLayer, RbfLayer, SimpleLayer


    public abstract class Layer
    extends java.lang.Object
    implements NeuralLayer, java.lang.Runnable, java.io.Serializable, Inspectable, LearnableLayer
    The Layer object is the basic element forming the neural net. Primarily it consists of a number of neurons that apply a transfer function to the sum of a number of input patterns and convey the result to the output pattern. The input patterns are received from connected input listeners and the transformed results are passed to connected output listeners. The component also handles learning by accepting patterns of error gradients from output listeners, applying a reverse (inverse) transfer function and passing the result to the input listeners. Layers execute their own Threads to perform the perform the pattern conveyance, so that a network of Layers can operate in a multi-threaded manner. The execution and termination of the Thread is controlled by a Monitor object.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int STOP_FLAG
      Stop flag.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Layer()
      The empty constructor
      Layer(java.lang.String ElemName)
      Creates a named layer
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean addInputSynapse(InputPatternListener newListener)
      Adds a new input synapse to the layer
      void addNoise(double amplitude)
      Adds a noise componentto the biases of the layer and to all the input connected synapses.
      boolean addOutputSynapse(OutputPatternListener newListener)
      Adds a new output synapse to the layer
      java.util.TreeSet check()
      Get check messages from listeners.
      NeuralLayer copyInto(NeuralLayer newLayer)
      Copies one layer into another, to obtain a type-transformation from one kind of Layer to another.
      void finalize()
      Method to help remove disused references quickly when the layer goes out of scope.
      void fwdRun(Pattern pattIn)
      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
      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
      int getDimension()
      Returns the number of neurons contained in the layer
      double[] getLastOutputs()
      Gets the values lastly outputed by the neurons of this layer.
      java.lang.String getLayerName()
      Returns the name of the layer
      Learner getLearner()
      Returns the appropriate Learner object for this class depending on the Monitor.learningMode property value
      Monitor getMonitor()
      Returns the monitor object
      int getRows()
      Returns the dimension (# of neurons) of the Layer
      boolean hasStepCounter()
      Determine whether this layer has an input synapse attached that is a step counter.
      void init() 
      void initLearner()
      Initialize the Learner object of this layer
      java.lang.String InspectableTitle()
      Get the title for the inspectable interface
      java.util.Collection Inspections()
      Method to get a collection of bias inspections for this layer
      boolean isInputLayer()
      Determine whether this is an input layer.
      boolean isOutputLayer()
      Determine whether this is an output layer.
      boolean isRunning()
      Determine whether the execution thread is running
      void join()
      Waits for the current layer's thread to stop
      void randomize(double amplitude)
      Initialize the weights of the biases and of all the connected synapses
      void removeAllInputs()
      Remove all the input listeners of the layer
      void removeAllOutputs()
      Remove all the output listeners of the layer
      void removeInputSynapse(InputPatternListener newListener)
      Remove an input Listener
      void removeOutputSynapse(OutputPatternListener newListener)
      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 run()
      The core running engine of the layer.
      void setAllInputs(java.util.Vector newInputPatternListeners)
      Sets the Vector that contains all the input listeners.
      void setAllOutputs(java.util.Vector newOutputPatternListeners)
      Sets the Vector that contains all the output listeners.
      void setBias(Matrix newBias)
      Sets the matrix of biases
      void setInputSynapses(java.util.ArrayList newInputPatternListeners)
      Sets the Vector that contains all the input listeners.
      void setLayerName(java.lang.String newLayerName)
      Sets the name of the layer
      void setMonitor(Monitor mon)
      Sets the monitor object
      void setOutputSynapses(java.util.ArrayList newOutputPatternListeners)
      Sets the Vector that contains all the output listeners.
      void setRows(int newRows)
      Sets the dimension (# of neurons) of the Layer
      void start()
      Starts the Layer
      void stop()
      Stops the Layer
      java.lang.String toString()
      Produce a String representation of this layer
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • STOP_FLAG

        public static final int STOP_FLAG
        Stop flag. If the step has this value, the execution thread terminates.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Layer

        public Layer()
        The empty constructor
      • Layer

        public Layer(java.lang.String ElemName)
        Creates a named layer
        Parameters:
        ElemName - The name of the layer
    • Method Detail

      • addNoise

        public void addNoise(double amplitude)
        Adds a noise componentto the biases of the layer and to all the input connected synapses.
        Specified by:
        addNoise in interface NeuralLayer
        Parameters:
        amplitude - 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)
        Initialize the weights of the biases and of all the connected synapses
        Parameters:
        amplitude - the amplitude of the applied noise
      • copyInto

        public NeuralLayer copyInto(NeuralLayer newLayer)
        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
        Parameters:
        newLayer - the new layer with which to replace this one
        Returns:
        The new layer
      • getAllInputs

        public java.util.Vector getAllInputs()
        Returns the vector of the input listeners
        Specified by:
        getAllInputs in interface NeuralLayer
        Returns:
        the connected input pattern listeners
      • getAllOutputs

        public java.util.Vector getAllOutputs()
        Returns the vector of the output listeners
        Specified by:
        getAllOutputs in interface NeuralLayer
        Returns:
        the connected output pattern listeners
      • getBias

        public Matrix getBias()
        Return the bias matrix
        Specified by:
        getBias in interface NeuralLayer
        Returns:
        the layer biases
      • getDimension

        public int getDimension()
        Returns the number of neurons contained in the layer
        Returns:
        the number of neurons in the layer.
      • getLayerName

        public java.lang.String getLayerName()
        Returns the name of the layer
        Specified by:
        getLayerName in interface NeuralLayer
        Returns:
        the name of the layer
      • getRows

        public int getRows()
        Returns the dimension (# of neurons) of the Layer
        Specified by:
        getRows in interface NeuralLayer
        Returns:
        the number of neurons in the layer
      • removeAllInputs

        public void removeAllInputs()
        Remove all the input listeners of the layer
        Specified by:
        removeAllInputs in interface NeuralLayer
      • removeAllOutputs

        public void removeAllOutputs()
        Remove all the output listeners of the layer
        Specified by:
        removeAllOutputs in interface NeuralLayer
      • getLastOutputs

        public double[] getLastOutputs()
        Gets the values lastly outputed by the neurons of this layer.
        Returns:
        the values lastly outputed.
      • setAllInputs

        public void setAllInputs(java.util.Vector newInputPatternListeners)
        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
        Parameters:
        newInputPatternListeners - The vector containing the list of input synapses
      • setInputSynapses

        public void setInputSynapses(java.util.ArrayList newInputPatternListeners)
        Sets the Vector that contains all the input listeners. It accepts an ArrayList as parameter. Added for Spring Can be useful to set the input synapses taken from another Layer
        Parameters:
        newInputPatternListeners - The vector containing the list of input synapses
      • setAllOutputs

        public void setAllOutputs(java.util.Vector newOutputPatternListeners)
        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
        Parameters:
        newOutputPatternListeners - The vector containing the list of output synapses
      • setOutputSynapses

        public void setOutputSynapses(java.util.ArrayList newOutputPatternListeners)
        Sets the Vector that contains all the output listeners. It accepts an ArrayList as parameter. Added for Spring Can be useful to set the output synapses taken from another Layer
        Parameters:
        newOutputPatternListeners - The vector containing the list of output synapses
      • setBias

        public void setBias(Matrix newBias)
        Sets the matrix of biases
        Specified by:
        setBias in interface NeuralLayer
        Parameters:
        newBias - The Matrix object containing the biases
      • addInputSynapse

        public boolean addInputSynapse(InputPatternListener newListener)
        Adds a new input synapse to the layer
        Specified by:
        addInputSynapse in interface NeuralLayer
        Parameters:
        newListener - The new input synapse to add
        Returns:
        whether the listener was added
      • setLayerName

        public void setLayerName(java.lang.String newLayerName)
        Sets the name of the layer
        Specified by:
        setLayerName in interface NeuralLayer
        Parameters:
        newLayerName - The name
      • setMonitor

        public void setMonitor(Monitor mon)
        Sets the monitor object
        Specified by:
        setMonitor in interface NeuralLayer
        Parameters:
        mon - The Monitor
      • addOutputSynapse

        public boolean addOutputSynapse(OutputPatternListener newListener)
        Adds a new output synapse to the layer
        Specified by:
        addOutputSynapse in interface NeuralLayer
        Parameters:
        newListener - The new output synapse
        Returns:
        whether the listener was added
      • setRows

        public void setRows(int newRows)
        Sets the dimension (# of neurons) of the Layer
        Specified by:
        setRows in interface NeuralLayer
        Parameters:
        newRows - The number of the neurons contained in the Layer
      • start

        public void start()
        Starts the Layer
        Specified by:
        start in interface NeuralLayer
      • init

        public void init()
      • stop

        public void stop()
        Stops the Layer
      • isRunning

        public boolean isRunning()
        Determine whether the execution thread is running
        Specified by:
        isRunning in interface NeuralLayer
        Returns:
        whether it is running
      • check

        public java.util.TreeSet check()
        Get check messages from listeners. Subclasses should call this method from thier own check method.
        Specified by:
        check in interface NeuralLayer
        Returns:
        validation errors.
        See Also:
        NeuralLayer
      • toString

        public java.lang.String toString()
        Produce a String representation of this layer
        Overrides:
        toString in class java.lang.Object
        Returns:
        string representation of the layer
        See Also:
        Object.toString()
      • finalize

        public void finalize()
                      throws java.lang.Throwable
        Method to help remove disused references quickly when the layer goes out of scope.
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable
        See Also:
        Object.finalize()
      • Inspections

        public java.util.Collection Inspections()
        Method to get a collection of bias inspections for this layer
        Specified by:
        Inspections in interface Inspectable
        Returns:
        See Also:
        org.joone.Inspection
      • InspectableTitle

        public java.lang.String InspectableTitle()
        Get the title for the inspectable interface
        Specified by:
        InspectableTitle in interface Inspectable
        Returns:
        See Also:
        org.joone.InspectionFrame
      • hasStepCounter

        public boolean hasStepCounter()
        Determine whether this layer has an input synapse attached that is a step counter.
        Returns:
        whether it is a step counter.
      • isInputLayer

        public boolean isInputLayer()
        Determine whether this is an input layer.
        Returns:
        whether this is an input layer
      • isOutputLayer

        public boolean isOutputLayer()
        Determine whether this is an output layer.
        Returns:
        whether this is an output layer
      • getLearner

        public Learner getLearner()
        Returns the appropriate Learner object for this class depending on the Monitor.learningMode property value
        Specified by:
        getLearner in interface Learnable
        Returns:
        the Learner object if applicable, otherwise null
        See Also:
        Learnable.getLearner()
      • join

        public void join()
        Waits for the current layer's thread to stop
      • fwdRun

        public void fwdRun(Pattern pattIn)
        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
      • revRun

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

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.