|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.neuroph.core.Neuron
public class Neuron
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) )
InputFunction
,
TransferFunction
,
Serialized FormField 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 on 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 |
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 |
---|
protected Layer parentLayer
protected java.util.Vector<Connection> inputConnections
protected java.util.Vector<Connection> outConnections
protected transient double netInput
protected transient double output
protected transient double error
protected InputFunction inputFunction
protected TransferFunction transferFunction
Constructor Detail |
---|
public Neuron()
public Neuron(InputFunction inputFunction, TransferFunction transferFunction)
inputFunction
- input function for this neurontransferFunction
- transfer function for this neuronMethod Detail |
---|
public void calculate()
public void reset()
public void setInput(double input)
input
- input value to setpublic double getNetInput()
public double getOutput()
public boolean hasInputConnections()
public java.util.Iterator<Connection> getInputsIterator()
public void addInputConnection(Connection connection)
connection
- input connection to addpublic void addInputConnection(Neuron fromNeuron)
fromNeuron
- neuron to connect frompublic void addInputConnection(Neuron fromNeuron, double weightVal)
fromNeuron
- neuron to connect fromweightVal
- connection weight valueprotected void addOutputConnection(Connection connection)
connection
- output connection to addpublic java.util.Vector<Connection> getInputConnections()
public java.util.Vector<Connection> getOutConnections()
public void removeInputConnectionFrom(Neuron fromNeuron)
fromNeuron
- neuron which is connected as inputpublic Connection getConnectionFrom(Neuron fromNeuron)
public void setInputFunction(InputFunction inputFunction)
inputFunction
- input function to set for this neuronpublic void setTransferFunction(TransferFunction transferFunction)
transferFunction
- transfer function for this neuronpublic InputFunction getInputFunction()
public TransferFunction getTransferFunction()
public void setParentLayer(Layer parent)
parent
- reference on layer in which the cell is locatedpublic Layer getParentLayer()
public java.util.Vector<Weight> getWeightsVector()
public double getError()
public void setError(double error)
error
- neuron errorpublic void setOutput(double output)
output
- value to setpublic void randomizeInputWeights()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |