All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.classifiers.neural.NeuralConnection

java.lang.Object
    |
    +----weka.classifiers.neural.NeuralConnection

public abstract class NeuralConnection
extends java.lang.Object
implements java.io.Serializable
Abstract unit in a NeuralNetwork.

Version:
$Revision: 1.2 $
Author:
Malcolm Ware (mfw4@cs.waikato.ac.nz)

Variable Index

 o CONNECTED
This flag is set once the unit has a connection.
 o INPUT
This unit is an input unit.
 o OUTPUT
This unit is an output unit.
 o PURE_INPUT
This unit is a pure input unit.
 o PURE_OUTPUT
This unit is a pure output unit.
 o UNCONNECTED
This unit is not connected to any others.

Constructor Index

 o NeuralConnection(String)
Constructs The unit with the basic connection information prepared for use.

Method Index

 o connect(NeuralConnection, NeuralConnection)
Connects two units together.
 o disconnect(NeuralConnection, NeuralConnection)
Disconnects two units.
 o drawHighlight(Graphics, int, int)
Call this function to draw the node highlighted.
 o drawInputLines(Graphics, int, int)
Call this function to draw the nodes input connections.
 o drawNode(Graphics, int, int)
Call this function to draw the node.
 o drawOutputLines(Graphics, int, int)
Call this function to draw the nodes output connections.
 o errorValue(boolean)
Call this to get the error value of this unit.
 o getId()
 
 o getInputNums()
Use this to get easy access to the input numbers.
 o getInputs()
Use this to get easy access to the inputs.
 o getNumInputs()
 
 o getNumOutputs()
 
 o getOutputNums()
Use this to get easy access to the output numbers.
 o getOutputs()
Use this to get easy access to the outputs.
 o getType()
 
 o getX()
 
 o getY()
 
 o onUnit(Graphics, int, int, int, int)
Call this function to determine if the point at x,y is on the unit.
 o outputValue(boolean)
Call this to get the output value of this unit.
 o removeAllInputs()
This function will remove all the inputs to this unit.
 o removeAllOutputs()
This function will remove all outputs to this unit.
 o reset()
Call this to reset the unit for another run.
 o setType(int)
 
 o setX(double)
 
 o setY(double)
 
 o updateWeights(double, double)
Call this function to update the weight values at this unit.
 o weightValue(int)
Call this to get the weight value on a particular connection.

Field Detail

 o UNCONNECTED
public static final int UNCONNECTED
          This unit is not connected to any others.
 o PURE_INPUT
public static final int PURE_INPUT
          This unit is a pure input unit.
 o PURE_OUTPUT
public static final int PURE_OUTPUT
          This unit is a pure output unit.
 o INPUT
public static final int INPUT
          This unit is an input unit.
 o OUTPUT
public static final int OUTPUT
          This unit is an output unit.
 o CONNECTED
public static final int CONNECTED
          This flag is set once the unit has a connection.

Constructor Detail

 o NeuralConnection
public NeuralConnection(java.lang.String id)
          Constructs The unit with the basic connection information prepared for use.

Method Detail

 o getId
public java.lang.String getId()
Returns:
The identity string of this unit.
 o getType
public int getType()
Returns:
The type of this unit.
 o setType
public void setType(int t)
Parameters:
t - The new type of this unit.
 o reset
public abstract void reset()
          Call this to reset the unit for another run. It is expected by that this unit will call the reset functions of all input units to it. It is also expected that this will not be done if the unit has already been reset (or atleast appears to be).
 o outputValue
public abstract double outputValue(boolean calculate)
          Call this to get the output value of this unit.
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.
 o errorValue
public abstract double errorValue(boolean calculate)
          Call this to get the error value of this unit.
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.
 o weightValue
public double weightValue(int n)
          Call this to get the weight value on a particular connection.
Parameters:
n - The connection number to get the weight for, -1 if The threshold weight should be returned.
Returns:
This function will default to return 1. If overridden, it should return 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.
 o 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.
Parameters:
l - The learning Rate to use.
m - The momentum to use.
 o getInputs
public NeuralConnection[] getInputs()
          Use this to get easy access to the inputs. It is not advised to change the entries in this list (use the connecting and disconnecting functions to do that)
Returns:
The inputs list.
 o getOutputs
public NeuralConnection[] getOutputs()
          Use this to get easy access to the outputs. It is not advised to change the entries in this list (use the connecting and disconnecting functions to do that)
Returns:
The outputs list.
 o getInputNums
public int[] getInputNums()
          Use this to get easy access to the input numbers. It is not advised to change the entries in this list (use the connecting and disconnecting functions to do that)
Returns:
The input nums list.
 o getOutputNums
public int[] getOutputNums()
          Use this to get easy access to the output numbers. It is not advised to change the entries in this list (use the connecting and disconnecting functions to do that)
Returns:
The outputs list.
 o getX
public double getX()
Returns:
the x coord.
 o getY
public double getY()
Returns:
the y coord.
 o setX
public void setX(double x)
Parameters:
x - The new value for it's x pos.
 o setY
public void setY(double y)
Parameters:
y - The new value for it's y pos.
 o 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.
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.
 o drawNode
public void drawNode(java.awt.Graphics g,
                     int w,
                     int h)
          Call this function to draw the node.
Parameters:
g - The graphics context.
w - The width of the drawing area.
h - The height of the drawing area.
 o drawHighlight
public void drawHighlight(java.awt.Graphics g,
                          int w,
                          int h)
          Call this function to draw the node highlighted.
Parameters:
g - The graphics context.
w - The width of the drawing area.
h - The height of the drawing area.
 o drawInputLines
public void drawInputLines(java.awt.Graphics g,
                           int w,
                           int h)
          Call this function to draw the nodes input connections.
Parameters:
g - The graphics context.
w - The width of the drawing area.
h - The height of the drawing area.
 o drawOutputLines
public void drawOutputLines(java.awt.Graphics g,
                            int w,
                            int h)
          Call this function to draw the nodes output connections.
Parameters:
g - The graphics context.
w - The width of the drawing area.
h - The height of the drawing area.
 o 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.
 o removeAllOutputs
public void removeAllOutputs()
          This function will remove all outputs to this unit. In doing so it will also terminate the connections at the other end.
 o getNumInputs
public int getNumInputs()
Returns:
The number of input connections.
 o getNumOutputs
public int getNumOutputs()
Returns:
The number of output connections.
 o connect
public static boolean connect(NeuralConnection s,
                              NeuralConnection t)
          Connects two units together.
Parameters:
s - The source unit.
t - The target unit.
Returns:
True if the units were connected, false otherwise.
 o disconnect
public static boolean disconnect(NeuralConnection s,
                                 NeuralConnection t)
          Disconnects two units.
Parameters:
s - The source unit.
t - The target unit.
Returns:
True if the units were disconnected, false if they weren't (probably due to there being no connection).

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home