Documentation of 'org.neuroph.core.Neuron' Java class
Neuron
org.neuroph.core

Class Neuron

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable
    Direct Known Subclasses:
    BiasNeuron, DelayedNeuron, InputNeuron, InputOutputNeuron, ThresholdNeuron


    public class Neuron
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Cloneable
     Basic general neuron model according to McCulloch-Pitts neuron model.
     Different neuron models can be created by using different input and transfer functions for instances of this class,
     or by deriving from this class. The neuron is basic processing element of neural network.
     This class implements the following behaviour:
    
     output = transferFunction( inputFunction(inputConnections) )
     
    See Also:
    InputFunction, TransferFunction, Serialized Form
    • Constructor Detail

      • Neuron

        public Neuron()
        Creates an instance of Neuron with default settings: weighted sum input function and Step transfer function. This is the basic McCulloch-Pitts neuron model.
      • Neuron

        public Neuron(InputFunction inputFunction,
                      TransferFunction transferFunction)
        Creates an instance of Neuron with the specified input and transfer functions.
        Parameters:
        inputFunction - input function for this neuron
        transferFunction - transfer function for this neuron
    • Method Detail

      • calculate

        public void calculate()
        Calculates neuron's output
      • reset

        public void reset()
        Sets input and output activation levels to zero
      • setInput

        public void setInput(double input)
        Sets neuron's input
        Parameters:
        input - input value to set
      • getNetInput

        public double getNetInput()
        Returns total net input
        Returns:
        total net input
      • getOutput

        public double getOutput()
        Returns neuron's output
        Returns:
        neuron output
      • hasInputConnections

        public boolean hasInputConnections()
        Returns true if there are input connections for this neuron, false otherwise
        Returns:
        true if there is input connection, false otherwise
      • hasOutputConnectionTo

        public boolean hasOutputConnectionTo(Neuron toNeuron)
        Return true if this neuron has output connections to specified toNeuron
        Parameters:
        toNeuron -
        Returns:
        true if this neuron has output connections to specified toNeuron, false otherwise
      • hasInputConnectionFrom

        public boolean hasInputConnectionFrom(Neuron neuron)
        Parameters:
        neuron -
        Returns:
      • addInputConnection

        public void addInputConnection(Connection connection)
        Adds the specified input connection
        Parameters:
        connection - input connection to add
      • addInputConnection

        public void addInputConnection(Neuron fromNeuron)
        Adds input connection from specified neuron.
        Parameters:
        fromNeuron - neuron to connect from
      • addInputConnection

        public void addInputConnection(Neuron fromNeuron,
                                       double weightVal)
        Adds input connection with the given weight, from given neuron
        Parameters:
        fromNeuron - neuron to connect from
        weightVal - connection weight value
      • getInputConnections

        public final java.util.List<Connection> getInputConnections()
        Returns input connections for this neuron
        Returns:
        input connections of this neuron
      • getOutConnections

        public final java.util.List<Connection> getOutConnections()
        Returns output connections from this neuron
        Returns:
        output connections from this neuron
      • removeInputConnectionFrom

        public void removeInputConnectionFrom(Neuron fromNeuron)
        Removes input connection which is connected to specified neuron
        Parameters:
        fromNeuron - neuron which is connected as input
      • removeOutputConnectionTo

        public void removeOutputConnectionTo(Neuron toNeuron)
      • removeAllInputConnections

        public void removeAllInputConnections()
      • removeAllOutputConnections

        public void removeAllOutputConnections()
      • removeAllConnections

        public void removeAllConnections()
      • getConnectionFrom

        public Connection getConnectionFrom(Neuron fromNeuron)
        Gets input connection from the specified neuron * @param fromNeuron neuron connected to this neuron as input
      • setInputFunction

        public void setInputFunction(InputFunction inputFunction)
        Sets input function
        Parameters:
        inputFunction - input function for this neuron
      • setTransferFunction

        public void setTransferFunction(TransferFunction transferFunction)
        Sets transfer function
        Parameters:
        transferFunction - transfer function for this neuron
      • getInputFunction

        public InputFunction getInputFunction()
        Returns input function
        Returns:
        input function
      • getTransferFunction

        public TransferFunction getTransferFunction()
        Returns transfer function
        Returns:
        transfer function
      • setParentLayer

        public void setParentLayer(Layer parent)
        Sets reference to parent layer for this neuron (layer in which the neuron is located)
        Parameters:
        parent - reference on layer in which the cell is located
      • getParentLayer

        public Layer getParentLayer()
        Returns reference to parent layer for this neuron
        Returns:
        parent layer for this neuron
      • getWeights

        public Weight[] getWeights()
        Returns weights vector of input connections
        Returns:
        weights vector of input connections
      • getDelta

        public double getDelta()
        Returns delta (error) for this neuron. This is used by backpropagation learning rules.
        Returns:
        error for this neuron which is set by learning rule
      • setDelta

        public void setDelta(double delta)
        Sets delta for this neuron. This is used by backpropagation learning rules.
        Parameters:
        delta - neuron delta
      • getError

        public double getError()
        Returns error for this neuron. This is used by supervised learing rules.
        Returns:
        error for this neuron which is set by learning rule
      • setError

        public void setError(double error)
        Sets error for this neuron. This is used by supervised learing rules.
        Parameters:
        error - neuron error
      • setOutput

        public void setOutput(double output)
        Sets this neuron output
        Parameters:
        output - value to set
      • initializeWeights

        public void initializeWeights(double value)
        Initialize weights for all input connections to specified value
        Parameters:
        value - the weight value
      • getLabel

        public java.lang.String getLabel()
        Returns label for this neuron
        Returns:
        label for this neuron
      • setLabel

        public void setLabel(java.lang.String label)
        Sets the label for this neuron
        Parameters:
        label - neuron label to set
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.