NeuralNode (original) (raw)
java.lang.Object
- weka.classifiers.functions.neural.NeuralConnection
- weka.classifiers.functions.neural.NeuralNode
All Implemented Interfaces:
java.io.Serializable, RevisionHandler
public class NeuralNode
extends NeuralConnection
This class is used to represent a node in the neuralnet.
Version: Revision:5403Revision: 5403 Revision:5403
Author:
Malcolm Ware (mfw4@cs.waikato.ac.nz)
See Also:
Serialized Form
Field Summary
* ### Fields inherited from class weka.classifiers.functions.neural.[NeuralConnection](../../../../weka/classifiers/functions/neural/NeuralConnection.html "class in weka.classifiers.functions.neural") `[CONNECTED](../../../../weka/classifiers/functions/neural/NeuralConnection.html#CONNECTED), [INPUT](../../../../weka/classifiers/functions/neural/NeuralConnection.html#INPUT), [OUTPUT](../../../../weka/classifiers/functions/neural/NeuralConnection.html#OUTPUT), [PURE_INPUT](../../../../weka/classifiers/functions/neural/NeuralConnection.html#PURE%5FINPUT), [PURE_OUTPUT](../../../../weka/classifiers/functions/neural/NeuralConnection.html#PURE%5FOUTPUT), [UNCONNECTED](../../../../weka/classifiers/functions/neural/NeuralConnection.html#UNCONNECTED)`
Constructor Summary
Constructors
Constructor and Description NeuralNode(java.lang.String id, java.util.Random r,NeuralMethod m) Method Summary
All Methods Instance Methods Concrete Methods
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. * ### Methods inherited from class weka.classifiers.functions.neural.[NeuralConnection](../../../../weka/classifiers/functions/neural/NeuralConnection.html "class in weka.classifiers.functions.neural") `[connect](../../../../weka/classifiers/functions/neural/NeuralConnection.html#connect-weka.classifiers.functions.neural.NeuralConnection-weka.classifiers.functions.neural.NeuralConnection-), [disconnect](../../../../weka/classifiers/functions/neural/NeuralConnection.html#disconnect-weka.classifiers.functions.neural.NeuralConnection-weka.classifiers.functions.neural.NeuralConnection-), [drawHighlight](../../../../weka/classifiers/functions/neural/NeuralConnection.html#drawHighlight-java.awt.Graphics-int-int-), [drawInputLines](../../../../weka/classifiers/functions/neural/NeuralConnection.html#drawInputLines-java.awt.Graphics-int-int-), [drawNode](../../../../weka/classifiers/functions/neural/NeuralConnection.html#drawNode-java.awt.Graphics-int-int-), [drawOutputLines](../../../../weka/classifiers/functions/neural/NeuralConnection.html#drawOutputLines-java.awt.Graphics-int-int-), [getId](../../../../weka/classifiers/functions/neural/NeuralConnection.html#getId--), [getInputNums](../../../../weka/classifiers/functions/neural/NeuralConnection.html#getInputNums--), [getInputs](../../../../weka/classifiers/functions/neural/NeuralConnection.html#getInputs--), [getNumInputs](../../../../weka/classifiers/functions/neural/NeuralConnection.html#getNumInputs--), [getNumOutputs](../../../../weka/classifiers/functions/neural/NeuralConnection.html#getNumOutputs--), [getOutputNums](../../../../weka/classifiers/functions/neural/NeuralConnection.html#getOutputNums--), [getOutputs](../../../../weka/classifiers/functions/neural/NeuralConnection.html#getOutputs--), [getType](../../../../weka/classifiers/functions/neural/NeuralConnection.html#getType--), [getX](../../../../weka/classifiers/functions/neural/NeuralConnection.html#getX--), [getY](../../../../weka/classifiers/functions/neural/NeuralConnection.html#getY--), [onUnit](../../../../weka/classifiers/functions/neural/NeuralConnection.html#onUnit-java.awt.Graphics-int-int-int-int-), [removeAllOutputs](../../../../weka/classifiers/functions/neural/NeuralConnection.html#removeAllOutputs--), [setType](../../../../weka/classifiers/functions/neural/NeuralConnection.html#setType-int-), [setX](../../../../weka/classifiers/functions/neural/NeuralConnection.html#setX-double-), [setY](../../../../weka/classifiers/functions/neural/NeuralConnection.html#setY-double-)` * ### Methods inherited from class java.lang.Object `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
Constructor Detail
* #### NeuralNode public NeuralNode(java.lang.String id, java.util.Random r, [NeuralMethod](../../../../weka/classifiers/functions/neural/NeuralMethod.html "interface in weka.classifiers.functions.neural") m) Parameters: `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.
Method Detail
* #### setMethod public void setMethod([NeuralMethod](../../../../weka/classifiers/functions/neural/NeuralMethod.html "interface in weka.classifiers.functions.neural") 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. Parameters: `m` \- The new method. * #### getMethod public [NeuralMethod](../../../../weka/classifiers/functions/neural/NeuralMethod.html "interface in weka.classifiers.functions.neural") getMethod() * #### outputValue public double outputValue(boolean calculate) Call this to get the output value of this unit. Specified by: `[outputValue](../../../../weka/classifiers/functions/neural/NeuralConnection.html#outputValue-boolean-)` in class `[NeuralConnection](../../../../weka/classifiers/functions/neural/NeuralConnection.html "class in weka.classifiers.functions.neural")` Parameters: `calculate` \- True if the value should be calculated if it hasn't been already. Returns: The output value, or NaN, if the value has not been calculated. * #### errorValue public double errorValue(boolean calculate) Call this to get the error value of this unit. Specified by: `[errorValue](../../../../weka/classifiers/functions/neural/NeuralConnection.html#errorValue-boolean-)` in class `[NeuralConnection](../../../../weka/classifiers/functions/neural/NeuralConnection.html "class in weka.classifiers.functions.neural")` Parameters: `calculate` \- True if the value should be calculated if it hasn't been already. Returns: The error value, or NaN, if the value has not been calculated. * #### reset public void reset() Call this to reset the value and error for this unit, ready for the next run. This will also call the reset function of all units that are connected as inputs to this one. This is also the time that the update for the listeners will be performed. Specified by: `[reset](../../../../weka/classifiers/functions/neural/NeuralConnection.html#reset--)` in class `[NeuralConnection](../../../../weka/classifiers/functions/neural/NeuralConnection.html "class in weka.classifiers.functions.neural")` * #### saveWeights public void saveWeights() Call this to have the connection save the current weights. Specified by: `[saveWeights](../../../../weka/classifiers/functions/neural/NeuralConnection.html#saveWeights--)` in class `[NeuralConnection](../../../../weka/classifiers/functions/neural/NeuralConnection.html "class in weka.classifiers.functions.neural")` * #### restoreWeights public void restoreWeights() Call this to have the connection restore from the saved weights. Specified by: `[restoreWeights](../../../../weka/classifiers/functions/neural/NeuralConnection.html#restoreWeights--)` in class `[NeuralConnection](../../../../weka/classifiers/functions/neural/NeuralConnection.html "class in weka.classifiers.functions.neural")` * #### weightValue public double weightValue(int n) Call this to get the weight value on a particular connection. Overrides: `[weightValue](../../../../weka/classifiers/functions/neural/NeuralConnection.html#weightValue-int-)` in class `[NeuralConnection](../../../../weka/classifiers/functions/neural/NeuralConnection.html "class in weka.classifiers.functions.neural")` Parameters: `n` \- The connection number to get the weight for, -1 if The threshold weight should be returned. Returns: The value for the specified connection or if -1 then it should return the threshold value. If no value exists for the specified connection, NaN will be returned. * #### getWeights public double[] getWeights() call this function to get the weights array. This will also allow the weights to be updated. Returns: The weights array. * #### getChangeInWeights public double[] getChangeInWeights() call this function to get the chnage in weights array. This will also allow the change in weights to be updated. Returns: The change in weights array. * #### updateWeights public void updateWeights(double l, double m) Call this function to update the weight values at this unit. After the weights have been updated at this unit, All the input connections will then be called from this to have their weights updated. Overrides: `[updateWeights](../../../../weka/classifiers/functions/neural/NeuralConnection.html#updateWeights-double-double-)` in class `[NeuralConnection](../../../../weka/classifiers/functions/neural/NeuralConnection.html "class in weka.classifiers.functions.neural")` Parameters: `l` \- The learning rate to use. `m` \- The momentum to use. * #### removeAllInputs public void removeAllInputs() This function will remove all the inputs to this unit. In doing so it will also terminate the connections at the other end. Overrides: `[removeAllInputs](../../../../weka/classifiers/functions/neural/NeuralConnection.html#removeAllInputs--)` in class `[NeuralConnection](../../../../weka/classifiers/functions/neural/NeuralConnection.html "class in weka.classifiers.functions.neural")` * #### getRevision public java.lang.String getRevision() Returns the revision string. Returns: the revision