Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Neuroph
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.neuroph.core
Class Neuron

    java.lang.Object
      org.neuroph.core.Neuron

All Implemented Interfaces:
  java.io.Serializable

Direct Known Subclasses:
  BiasNeuron, DelayedNeuron, IACNeuron, InputOutputNeuron, ThresholdNeuron

    public class Neuron

extends java.lang.Object
implements java.io.Serializable

     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

Field Summary
`protected double` | `error` Local error for this neuron
`protected java.util.Vector<Connection>` | `inputConnections` Collection of neuron's input connections (connections to this neuron)
`protected InputFunction` | `inputFunction` Input function for this neuron
`protected double` | `netInput` Total net input for this neuron.
`protected java.util.Vector<Connection>` | `outConnections` Collection of neuron's output connections (connections from this to other neurons)
`protected double` | `output` Neuron output
`protected Layer` | `parentLayer` Parent layer for this neuron
`protected TransferFunction` | `transferFunction` Transfer function for this neuron

Constructor Summary
`Neuron()` Creates an instance of Neuron with the weighted sum, input function and Step transfer function.
`Neuron(InputFunction inputFunction, TransferFunction transferFunction)` Creates an instance of Neuron with the specified input and transfer functions.

Method Summary
`void` | `addInputConnection(Connection connection)` Adds the specified input connection
`void` | `addInputConnection(Neuron fromNeuron)` Adds input connection from specified neuron
`void` | `addInputConnection(Neuron fromNeuron, double weightVal)` Adds input connection with the given weight, from given neuron
`protected void` | `addOutputConnection(Connection connection)` Adds the specified output connection
`void` | `calculate()` Calculates neuron's output
`Connection` | `getConnectionFrom(Neuron fromNeuron)` Gets input connection from the specified neuron * @param fromNeuron neuron connected to this neuron as input
`double` | `getError()` Returns error for this neuron.
`java.util.Vector<Connection>` | `getInputConnections()` Returns input connections for this neuron as Vector collection
`InputFunction` | `getInputFunction()` Returns input function
`java.util.Iterator<Connection>` | `getInputsIterator()` Returns Iterator interface for accessing input connections
`double` | `getNetInput()` Returns total net input
`java.util.Vector<Connection>` | `getOutConnections()` Returns output connections from this neuron
`double` | `getOutput()` Returns neuron's output
`Layer` | `getParentLayer()` Returns reference to parent layer for this neuron
`TransferFunction` | `getTransferFunction()` Returns transfer function
`java.util.Vector<Weight>` | `getWeightsVector()` Returns weights vector of input connections
`boolean` | `hasInputConnections()` Returns true if there are input connections for this neuron, false otherwise
`void` | `initializeWeights(double value)` Initialize weights for all input connections to specified value
`void` | `initializeWeights(double min, double max)` Initialize weights for all input connections with random value within specified interval
`void` | `initializeWeights(java.util.Random generator)` Initialize weights for all input connections to using random number generator
`void` | `randomizeInputWeights()` Randomize all input weights
`void` | `removeInputConnectionFrom(Neuron fromNeuron)` Removes input connection which is connected to specified neuron
`void` | `reset()` Sets input and output activation levels to zero
`void` | `setError(double error)` Sets error for this neuron.
`void` | `setInput(double input)` Sets neuron's input
`void` | `setInputFunction(InputFunction inputFunction)` Sets input function
`void` | `setOutput(double output)` Sets this neuron output
`void` | `setParentLayer(Layer parent)` Sets reference to parent layer for this neuron (layer in which the neuron is located)
`void` | `setTransferFunction(TransferFunction transferFunction)` Sets transfer function

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### parentLayer

    protected Layer parentLayer

  Parent layer for this neuron

### inputConnections

    protected java.util.Vector<Connection> inputConnections

  Collection of neuron's input connections (connections to this neuron)

### outConnections

    protected java.util.Vector<Connection> outConnections

  Collection of neuron's output connections (connections from this to other neurons)

### netInput

    protected transient double netInput

  Total net input for this neuron. Represents total input for this neuron received from input function.

### output

    protected transient double output

  Neuron output

### error

    protected transient double error

  Local error for this neuron

### inputFunction

    protected InputFunction inputFunction

  Input function for this neuron

### transferFunction

    protected TransferFunction transferFunction

  Transfer function for this neuron

Constructor Detail

### Neuron

    public Neuron()

  Creates an instance of Neuron with the weighted sum, input function and Step transfer function. This is the original 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

### getInputsIterator

    public java.util.Iterator<Connection> getInputsIterator()

  Returns Iterator interface for accessing input connections

  Returns:
    iterator interface for accessing input connections

### 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

### addOutputConnection

    protected void addOutputConnection(Connection connection)

  Adds the specified output connection

  Parameters:
    `connection` - output connection to add

### getInputConnections

    public java.util.Vector<Connection> getInputConnections()

  Returns input connections for this neuron as Vector collection

  Returns:
    input connections of this neuron

### getOutConnections

    public java.util.Vector<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

### 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

### getWeightsVector

    public java.util.Vector<Weight> getWeightsVector()

  Returns weights vector of input connections

  Returns:
    weights vector of input connections

### 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

### randomizeInputWeights

    public void randomizeInputWeights()

  Randomize all input weights

### initializeWeights

    public void initializeWeights(double value)

  Initialize weights for all input connections to specified value

  Parameters:
    `value` - the weight value

### initializeWeights

    public void initializeWeights(java.util.Random generator)

  Initialize weights for all input connections to using random number generator

  Parameters:
    `generator` - the random number generator

### initializeWeights

    public void initializeWeights(double min,
                                  double max)

  Initialize weights for all input connections with random value within specified interval

  Parameters:
    `min` -
    `max` -

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Neuroph
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD