weka.classifiers.functions
Class MultilayerPerceptron.NeuralEnd

java.lang.Object
  extended byweka.classifiers.functions.neural.NeuralConnection
      extended byweka.classifiers.functions.MultilayerPerceptron.NeuralEnd
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
MultilayerPerceptron

protected class MultilayerPerceptron.NeuralEnd
extends NeuralConnection

This inner class is used to connect the nodes in the network up to the data that they are classifying, Note that objects of this class are only suitable to go on the attribute side or class side of the network and not both.

See Also:
Serialized Form

Field Summary
private  boolean m_input
          True if node is an input, False if it's an output.
private  int m_link
          the value that represents the instance value this node represents.
 
Fields inherited from class weka.classifiers.functions.neural.NeuralConnection
CONNECTED, INPUT, m_id, m_inputList, m_inputNums, m_numInputs, m_numOutputs, m_outputList, m_outputNums, m_type, m_unitError, m_unitValue, m_weightsUpdated, m_x, m_y, OUTPUT, PURE_INPUT, PURE_OUTPUT, UNCONNECTED
 
Constructor Summary
MultilayerPerceptron.NeuralEnd(java.lang.String id)
           
 
Method Summary
 void drawHighlight(java.awt.Graphics g, int w, int h)
          Call this function to draw the node highlighted.
 void drawNode(java.awt.Graphics g, int w, int h)
          This will draw the node id to the graphics context.
 double errorValue(boolean calculate)
          Call this to get the error value of this unit, which in this case is the difference between the predicted class, and the actual class.
 int getLink()
           
 boolean onUnit(java.awt.Graphics g, int x, int y, int w, int h)
          Call this function to determine if the point at x,y is on the unit.
 double outputValue(boolean calculate)
          Call this to get the output value of this unit.
 void reset()
          Call this to reset the value and error for this unit, ready for the next run.
 void setLink(boolean input, int val)
          Call this function to set What this end unit represents.
 
Methods inherited from class weka.classifiers.functions.neural.NeuralConnection
allocateInputs, allocateOutputs, changeInputNum, changeOutputNum, connect, connectInput, connectOutput, disconnect, disconnectInput, disconnectOutput, drawInputLines, drawOutputLines, getId, getInputNums, getInputs, getNumInputs, getNumOutputs, getOutputNums, getOutputs, getType, getX, getY, removeAllInputs, removeAllOutputs, setType, setX, setY, updateWeights, weightValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_link

private int m_link
the value that represents the instance value this node represents. For an input it is the attribute number, for an output, if nominal it is the class value.


m_input

private boolean m_input
True if node is an input, False if it's an output.

Constructor Detail

MultilayerPerceptron.NeuralEnd

public MultilayerPerceptron.NeuralEnd(java.lang.String id)
Method Detail

onUnit

public boolean onUnit(java.awt.Graphics g,
                      int x,
                      int y,
                      int w,
                      int h)
Call this function to determine if the point at x,y is on the unit.

Overrides:
onUnit in class NeuralConnection
Parameters:
g - The graphics context for font size info.
x - The x coord.
y - The y coord.
w - The width of the display.
h - The height of the display.
Returns:
True if the point is on the unit, false otherwise.

drawNode

public void drawNode(java.awt.Graphics g,
                     int w,
                     int h)
This will draw the node id to the graphics context.

Overrides:
drawNode in class NeuralConnection
Parameters:
g - The graphics context.
w - The width of the drawing area.
h - The height of the drawing area.

drawHighlight

public void drawHighlight(java.awt.Graphics g,
                          int w,
                          int h)
Call this function to draw the node highlighted.

Overrides:
drawHighlight in class NeuralConnection
Parameters:
g - The graphics context.
w - The width of the drawing area.
h - The height of the drawing area.

outputValue

public double outputValue(boolean calculate)
Call this to get the output value of this unit.

Specified by:
outputValue in class NeuralConnection
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, which in this case is the difference between the predicted class, and the actual class.

Specified by:
errorValue in class NeuralConnection
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 in class NeuralConnection

setLink

public void setLink(boolean input,
                    int val)
             throws java.lang.Exception
Call this function to set What this end unit represents.

Parameters:
input - True if this unit is used for entering an attribute, False if it's used for determining a class value.
val - The attribute number or class type that this unit represents. (for nominal attributes).
Throws:
java.lang.Exception

getLink

public int getLink()
Returns:
link for this node.