learn
Class KMapNet

java.lang.Object
  |
  +--learn.KMapNet

public class KMapNet
extends java.lang.Object
implements java.io.Serializable

The KMapNet class provides the support necessary for the Kohonen Map neural network.

See Also:
Serialized Form

Field Summary
 javax.swing.JTextArea textArea1
           
 
Constructor Summary
KMapNet(java.lang.String name)
          Creates a Kohonen map neural network with the given name.
 
Method Summary
 void adjustNeighborhood()
          Adjusts the learn rate and neigborhood width (sigma) as training progresses.
 void adjustWeights()
          Adjusts the weights of the units in the neighborhood of the winner using the neighborhood, the distance from the winning unit, and the learn rate.
 void cluster()
          Trains or tests the network by setting the input unit activations, computing the outputs, selecting the winner, and, if in train mode, adjusting the weights.
 void computeDistances()
          Initializes a matrix of distances from each unit to all others in the network.
 void computeOutputs()
          Computes the outputs by doing a single forward pass through the network, computing the Euclidean distance from the input vector to all the output units.
 void createNetwork(int NumIn, int NumRows, int NumCols)
          Creates a Kohonen map network with the specified architecture.
 void display_network()
          Displays the relevant information for the network.
 int getCluster(double[] inputRec)
          Selects a winner from a single input record.
 java.util.Vector getData()
          Retrieves the vector of data used for training or testing.
 DataSet getDataSet()
          Returns the dataset for the Kohonen map.
 int getFieldsPerRec()
          Retrieves the number of fields per record.
 int getMode()
          Retrieves the mode network control parameter.
 int getNumRecs()
          Retrieves the number of data records.
 void readInputs()
          Reads data from the train or test dataset into the activations of the input units.
 void reset()
          Resets the network.
 void selectWinner()
          Selects the winner by finding the unit with the smallest activation.
 void setData(java.util.Vector data)
          Sets the vector of data used for training or testing.
 void setDataSet(DataSet dataset)
          Sets the dataset for the Kohonen map.
 void setFieldsPerRec(int fieldsPerRec)
          Sets the number of fields per record.
 void setMode(int mode)
          Sets the mode network control parameter.
 void setNumRecs(int numRecs)
          Sets the number of data records.
 void show_array(java.lang.String name, double[] arr)
          Displays an array of network data.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

textArea1

public transient javax.swing.JTextArea textArea1
Constructor Detail

KMapNet

public KMapNet(java.lang.String name)
Creates a Kohonen map neural network with the given name.
Parameters:
name - the String that contains the name of the network
Method Detail

setDataSet

public void setDataSet(DataSet dataset)
Sets the dataset for the Kohonen map.
Parameters:
dataset - the DataSet for the Kohonen map

getDataSet

public DataSet getDataSet()
Returns the dataset for the Kohonen map.
Parameters:
dataset - the DataSet for the Kohonen map

setNumRecs

public void setNumRecs(int numRecs)
Sets the number of data records.
Parameters:
numRecs - the number of data records

getNumRecs

public int getNumRecs()
Retrieves the number of data records.
Returns:
the number of data records

setFieldsPerRec

public void setFieldsPerRec(int fieldsPerRec)
Sets the number of fields per record.
Parameters:
fieldsPerRec - the number of fields per record

getFieldsPerRec

public int getFieldsPerRec()
Retrieves the number of fields per record.
Returns:
the number of fields per record

setData

public void setData(java.util.Vector data)
Sets the vector of data used for training or testing.
Parameters:
data - the Vector of test data

getData

public java.util.Vector getData()
Retrieves the vector of data used for training or testing.
Returns:
the Vector of test data

setMode

public void setMode(int mode)
Sets the mode network control parameter.
Parameters:
mode - the mode network control parameter (0=train, 1=run)

getMode

public int getMode()
Retrieves the mode network control parameter.
Returns:
the mode network control parameter (0=train, 1=run)

show_array

public void show_array(java.lang.String name,
                       double[] arr)
Displays an array of network data.
Parameters:
name - the String name of the information being displayed
arr - the array to be displayed

display_network

public void display_network()
Displays the relevant information for the network.

readInputs

public void readInputs()
Reads data from the train or test dataset into the activations of the input units.

computeDistances

public void computeDistances()
Initializes a matrix of distances from each unit to all others in the network.

adjustNeighborhood

public void adjustNeighborhood()
Adjusts the learn rate and neigborhood width (sigma) as training progresses.

computeOutputs

public void computeOutputs()
Computes the outputs by doing a single forward pass through the network, computing the Euclidean distance from the input vector to all the output units.

selectWinner

public void selectWinner()
Selects the winner by finding the unit with the smallest activation.

adjustWeights

public void adjustWeights()
Adjusts the weights of the units in the neighborhood of the winner using the neighborhood, the distance from the winning unit, and the learn rate.

getCluster

public int getCluster(double[] inputRec)
Selects a winner from a single input record.
Parameters:
inputRec - the double array which contains the input data
Returns:
the winner (cluster number)

cluster

public void cluster()
Trains or tests the network by setting the input unit activations, computing the outputs, selecting the winner, and, if in train mode, adjusting the weights.

reset

public void reset()
Resets the network.

createNetwork

public void createNetwork(int NumIn,
                          int NumRows,
                          int NumCols)
Creates a Kohonen map network with the specified architecture.
Parameters:
numIn - the number of input units
numRows - the number of rows
numCols - the number of columns
NumIn - the int
NumRows - the int
NumCols - the int