public class NeuralNode extends NeuralConnection
CONNECTED, INPUT, OUTPUT, PURE_INPUT, PURE_OUTPUT, UNCONNECTED
Constructor and Description |
---|
NeuralNode(java.lang.String id,
java.util.Random r,
NeuralMethod m) |
Modifier and Type | Method and Description |
---|---|
double |
errorValue(boolean calculate)
Call this to get the error value of this unit.
|
double[] |
getChangeInWeights()
call this function to get the chnage in weights array.
|
NeuralMethod |
getMethod() |
java.lang.String |
getRevision()
Returns the revision string.
|
double[] |
getWeights()
call this function to get the weights array.
|
double |
outputValue(boolean calculate)
Call this to get the output value of this unit.
|
void |
removeAllInputs()
This function will remove all the inputs to this unit.
|
void |
reset()
Call this to reset the value and error for this unit, ready for the next
run.
|
void |
restoreWeights()
Call this to have the connection restore from the saved
weights.
|
void |
saveWeights()
Call this to have the connection save the current
weights.
|
void |
setMethod(NeuralMethod m)
Set how this node should operate (note that the neural method has no
internal state, so the same object can be used by any number of nodes.
|
void |
updateWeights(double l,
double m)
Call this function to update the weight values at this unit.
|
double |
weightValue(int n)
Call this to get the weight value on a particular connection.
|
connect, disconnect, drawHighlight, drawInputLines, drawNode, drawOutputLines, getId, getInputNums, getInputs, getNumInputs, getNumOutputs, getOutputNums, getOutputs, getType, getX, getY, onUnit, removeAllOutputs, setType, setX, setY
public NeuralNode(java.lang.String id, java.util.Random r, NeuralMethod m)
id
- The string name for this node (used to id this node).r
- A random number generator used to generate initial weights.m
- The methods this node should use to update.public void setMethod(NeuralMethod m)
m
- The new method.public NeuralMethod getMethod()
public double outputValue(boolean calculate)
outputValue
in class NeuralConnection
calculate
- True if the value should be calculated if it hasn't been
already.public double errorValue(boolean calculate)
errorValue
in class NeuralConnection
calculate
- True if the value should be calculated if it hasn't been
already.public void reset()
reset
in class NeuralConnection
public void saveWeights()
saveWeights
in class NeuralConnection
public void restoreWeights()
restoreWeights
in class NeuralConnection
public double weightValue(int n)
weightValue
in class NeuralConnection
n
- The connection number to get the weight for, -1 if The threshold
weight should be returned.public double[] getWeights()
public double[] getChangeInWeights()
public void updateWeights(double l, double m)
updateWeights
in class NeuralConnection
l
- The learning rate to use.m
- The momentum to use.public void removeAllInputs()
removeAllInputs
in class NeuralConnection
public java.lang.String getRevision()