Artificial Neural Networks in Java
A Java implementation of a multi-layer, feed-forward network with back-propagation.
Main application class
Package NeuralNetwork
The program requires two command-line parameters which specify the two text configuration files that define the network.
An optional third parameter specifies the number of training iterations (default is 1).
- Parameter 1: config_file
- Defines the structure and the initial weights for a network.
The first non-empty line defines the values for the input layer for the network.
Each subsequent group of non-empty lines defines the nodes and weights for each subsequent layer.
Each line in a group specifies the link weights to a node from each node in the previous layer.
Values preceded by '=' represent bias nodes.
Specify '?' instead of a weight or bias value to generate a random value (0<=?<=1).
For example, the following represents a network with 2 inputs,
a hidden layer and 1 output, plus a couple of bias nodes:
# Input layer (2 inputs, 1 bias)
0 0 =1
# Hidden layer (2 nodes, 1 bias)
-0.07 0.22 -0.46
0.94 0.46 0.10
=1
# Output layer (1 node)
-0.22 0.58 0.78
- Parameter 2: data_file
- Defines a batch of inputs and expected outputs for the network defined in the config_file.
Each non-empty line specifies a set of input values and expected output values for a training batch.
For example, the following defines the inputs and outputs for the XOR function:
# XOR
0, 0, 0
0, 1, 1
1, 0, 1
1, 1, 0
Lines beginning with a '#' in the config_file and data_file are comments and are completely ignored.
Multiple values on the same line can be separated using spaces and/or commas.
The program output is a messy list of intermediate values calculated during each iteration,
mainly intended for debugging.
The output will probably improve once I figure out what to do with it.
Acknowledgements
The development of this package was guided by the excellent set of
neural network videos from Heaton Research.
|