Class NeuralNetwork.TrainingData

Enclosing class:

public class NeuralNetwork.TrainingData
extends java.lang.Object

Reads training data or the parameters of a trained network from a file

Constructor Summary
Method Summary
 java.util.Vector fetchNetworkDataFromFile(java.lang.String fileName, int fileType)
          Read from the file containing the data with which to train the network, or from a file containing a trained network.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public NeuralNetwork.TrainingData()
Method Detail


public java.util.Vector fetchNetworkDataFromFile(java.lang.String fileName,
                                                 int fileType)
Read from the file containing the data with which to train the network, or from a file containing a trained network.

The format of the training file is of the following form:

# Lines starting with this are comments
# Lines can have data values in the order below, or be comments,
# or be blank lines.

# Structure of the network (number of neurons in each layer)
# (input neurons, first hidden layer neurons, output neurons)

2 5 1

# Training Parameters:
# TrainingTolerance LearningRate MomentumMultipler

0.1 0.2 0.2

# Training data for the XOR problem
0.2 0.2

0.2 0.8

0.8 0.2

0.8 0.8
# end of training file

The training parameters and data values should go between 0 and 1. 0.2 and 0.8 are used instead of 0 and 1 because they make it less likely for the network to get stuck in a very slow training cycle. A line giving desired output neuron values follows each line giving the input neuron values.

fileName - Name of the file
fileType - TO_TRAIN if reading a file of training data, TRAINED if reading a file with a trained network
Vector returned has 3 elements: 1st is an int array with the network structure, 2nd is a double array with the network parameters, and 3rd is a Hashtable with the input - expected output pairs OR an ArrayList with the weight values for each layer, depending on whether the file type is TO_TRAIN or TRAINED