learn
Class BackProp

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

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

The BackProp class implements the standard backward propagation algorithm with momentum.

See Also:
Serialized Form

Field Summary
 javax.swing.JTextArea textArea1
           
 
Constructor Summary
BackProp(java.lang.String name)
          Creates a back propagation object with the given name.
 
Method Summary
 void adjustWeights()
          Adjusts the weights and thresholds by computing and adding the delta for each.
 void computeError()
          Starting at the output layer and working backward to the input layer, computes the following: the output layer errors and deltas based on the difference between the activations and the target values the squared errors used to calculate the average RMS error the hidden layer errors and deltas the input layer errors
 void computeOutputs()
          Computes the outputs by doing a single forward pass through the network.
 void createNetwork(int numIn, int numHidden, int numOut)
          Creates a backward propagation network with the specified architecture.
 void display_network()
          Displays the relevant information for the network.
 double getAveRMSError()
          Retrieves the average RMS error.
 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.
 double getLearnRate()
          Retrieves the learn rate parameter.
 int getMode()
          Retrieves the mode network control parameter.
 double getMomentum()
          Retrieves the momentum parameter.
 int getNumRecs()
          Retrieves the number of data records.
 double getPrediction(double[] inputRec)
          For networks with single continuous outputs only, retrieve the prediction.
 double logistic(double sum)
          Computes the activation value based on the given sum.
 void process()
          Processes the network by reading the input values, computing the output and error values, and, if training, adjusting the weights.
 void readInputs()
          Reads data from the train or test dataset into the activations of the input units.
 void reset()
          Resets the network.
 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 back prop object.
 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

BackProp

public BackProp(java.lang.String name)
Creates a back propagation object with the given name.
Parameters:
name - the String object that contains the name of the back prop object
Method Detail

setDataSet

public void setDataSet(DataSet dataset)
Sets the dataset for the back prop object.
Parameters:
dataset - the DataSet for this object

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)

getAveRMSError

public double getAveRMSError()
Retrieves the average RMS error.
Returns:
the average RMS error for the network

getLearnRate

public double getLearnRate()
Retrieves the learn rate parameter.
Returns:
the learn rate

getMomentum

public double getMomentum()
Retrieves the momentum parameter.
Returns:
the momentum

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. Default is to show only the activations array values.

logistic

public double logistic(double sum)
Computes the activation value based on the given sum.
Parameters:
sum - the double value which is the sum of the threshold and each input activation multiplied by the corresponding input weight
Returns:
the computed activation value

readInputs

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

computeOutputs

public void computeOutputs()
Computes the outputs by doing a single forward pass through the network.

computeError

public void computeError()
Starting at the output layer and working backward to the input layer, computes the following:
  1. the output layer errors and deltas based on the difference between the activations and the target values
  2. the squared errors used to calculate the average RMS error
  3. the hidden layer errors and deltas
  4. the input layer errors

adjustWeights

public void adjustWeights()
Adjusts the weights and thresholds by computing and adding the delta for each.

getPrediction

public double getPrediction(double[] inputRec)
For networks with single continuous outputs only, retrieve the prediction. Do a single forward pass through the network and return the output value
Parameters:
inputRec - the double array of input record
Returns:
the prediction

process

public void process()
Processes the network by reading the input values, computing the output and error values, and, if training, adjusting the weights.

reset

public void reset()
Resets the network.

createNetwork

public void createNetwork(int numIn,
                          int numHidden,
                          int numOut)
Creates a backward propagation network with the specified architecture.
Parameters:
numIn - the number of input units
numHidden - the number of hidden units
numOut - the number of output units