README for Backprop 0.9.5
-------------------------
Thank you for downloading Backprop! I hope that you find it to be a useful program.
This README file describes what Backprop is, and how to use it. It also includes a
summary of changes since the last version, information on what I plan to do in the
future, and how to contact me to request features or report bugs.
Updates
-------
The latest update of Backprop will always be available at the following URL:
http://www.users.cts.com/crash/s/slogan/backprop.html
Distribution Rights
-------------------
Backprop is Copyright 2003, 2004 Syd Logan. You have permission to redistribute at will,
for any legal and ethical purpose, provided that you include this README, unmodified,
along with this software.
Bug Reports and Suggestions
---------------------------
Please send bug reports to me, Syd Logan, at slogan@cts.com. Your input will help to
make Backprop a better, more stable program.
When reporting a bug, please include the following information:
-- Version of Backprop. The version is shown in the dialog that is displayed when you
select "About Backprop..." in the "Help" menu.
-- Operating system (e.g., Windows 95, 98, NT, 2000, XP).
-- Steps to reproduce the problem. Attach a copy of the data files you are using (the
the architecture file and training exemplars for problems encountered when training,
or the weight file and execution data for runtime problems) so that I can duplicate the
problem.
Thanks. If I can't understand the problem, I probably can't help, so the more information,
the better.
What Is Backprop?
-----------------
Backprop is a multi-layer neural network simulator that is based upon the popular
backpropagation learning algorithm. The goal of this simulator is to provide users
with a friendly and easy to use environment for experimenting with backpropagation
networks. To achieve this, I put a lot of effort into making the user interface
give as much visual feedback as possible, especially during network training, as
well as giving the user easy to use interfaces for changing the attributes of the
network, such as learning rates, momentum, and so forth. You can zoom in on the
network graphically to see weight values in more detail, or zoom out in order to
make visible larger, more complicated network architectures. You can speed up, or
slow down, the rate at which error graphics and network state are updated during
training. It is features like this that I hope will make Backprop your first choice
for experimenting with backpropagation neural networks.
Starting with version 0.9.5, you can now create and modify neural networks, and save
the results to disk as XML.
More details on the use of backpropagation are provided later in this document (see
"How to Use Backprop", below).
Backprop is written entirely in C++, and uses the Microsoft Foundation Classes (MFC)
for its user interface. It should run without any problems on any Windows platform,
starting with Windows 95.
How to Use Backprop
-------------------
If you are new to neural networks, or to backpropagation in particular, you should spend
some time reading about it before using backprop. There are numerous books, journals, and
web sites that contain information about backpropagation neural networks, and their uses.
The following should be enough to get you started, however.
A neural network is a program that can be trained to perform a task, usually pattern
recognition, classification, or function approximation. For example, you might train
a neural network to classify an input as belonging to a certain class, or to recognize
a series of pen strokes read on an input device as a letter of the alphabet. In order to
train the neural network to perform its intended task, you must do the following:
-- Come up with a neural network architecture. A neural network consists of a set of
layers, each containing a number of nodes. The number of layers in backpropagation
nets is usually 3 or larger. The first layer is called the input layer, and it has one
node for each input. The last layer is called the output layer, and it has one node for
each output. The remaining layers are called hidden layers, and the number of nodes in
these layers is harder to specify.
As an example, consider a neural network that is designed to classify patterns based on
the following input data:
Has Fins Has Gills Is a Fish
-----------------------------------
Yes No No
No No No
Yes Yes Yes
The first row of the table represents the fact that an animal that has fins, but not gills,
is not a fish. In converting this data to use with a neural network, we can simply replace
Yes with the value 1, no with the value 0 (or perhaps -1), and come up with the following:
Has Fins Has Gills Is a Fish
-----------------------------------
1 0 0
0 0 0
1 1 1
Some of you may know that solving this particular problem with a backpropagation network is
overkill, as it can be solved with simpler paradigms, such as the perceptron. However, it is
an easy to understand problem, and for those of you who are new to neural nets, simple is
better at this point. Backpropagation is usually used to solve much harder problems, so don't
let the simple nature of this example lead you to think backpropagation is only useful for
solving toy problems. That is most certainly not the case.
A neural network with two input nodes, one corresponding to Has Fins and one corresponding
to Has Gills, and one output node that corresponds to Is a Fish, can be used to solve the
above problem. Setting the input layer node one to 1 and node two to 0, in a properly trained
network, will result in the output node firing 0. The output node should also, in a properly
trained network, fire 0 if nodes one and two in the input layer are set to the value 0. The
number of hidden layers, and the number of nodes in each of the hidden layers, is more difficult
to specify. Many claim that coming up with the hidden layer architecture is more of an "art"
than a "science". I won't argue that. One of the nice things about backprop is you can easily
add or remove hidden layers, or change the number of nodes in the hidden layers, and see the
effects it has on training.
-- Once you have an architecture for the neural network in hand, you need to train the
neural network. This is done by presenting the neural network with examples that it can
use to learn the problem you want it to solve. These examples, also known as exemplars,
are repeatedly shown to the network until the network learns them, or some maximum number
of tries has been performed. It can, and often does, take tens of thousands of presentations
of a set of exemplars before a network becomes trained. How long it takes is a function of
the network architecture, the initial state of the network, nuances of the training
algorithm, and the set of exemplars. Changing one or more of these is all it sometimes takes
for a network that won't train to turn into a network that will. One of the design goals of
backprop is to give you the tools you need to visualize how changes in the exemplar set,
training algorithm, or architecture affect the ability of the neural network to train
successfully.
Once the network is trained, you can then use it to solve problems. This is done by presenting
data to the input layer nodes, and observing the values that result in the output layer.
Launching Backprop
------------------
To launch backprop, simply double click on the backprop icon.
Loading a Network Architecture File
-----------------------------------
The first thing that you must do after launching backprop is to load an architecture file that
describes the architecture of the network. The architecture file is a file that you create
in a text editor (like notepad). The architecture file is written using XML. Here is a simple
example of an architecture file that describes a network suitable for solving the "has fins,
has gills, is fish" problem above.
The architecture file consists of two tags, the tag, and the tag. The
tag defines the overall network architecture, which consists of layers. In this case, the network
has three layers. The first layer has a size attribute of 2, the second layer has a size attribute
of 3, and the third layer has a size attribute of 1. The size attribute defines how many neurons
are in the layer, therefore, this network has 2 neurons or nodes in the first layer, 3 in the
second layer, and 1 in the third layer. Also, the first layer is always the input layer, the last
layer is always the output layer, and the layers between are hidden layers. Thus, we have a
network that contains 3 layers, accepts 2 inputs, fires a single output, and has a hidden layer
that contains 3 nodes. The first node in the input layer will accept as input the "has fins"
attribute, the second node in the input layer will accept the "has gills" attribute, and the
output of the single neuron in the output layer will fire a value which represents the "is fish"
attribute. The goal of the network training, described below, will be to train the network so
that it fires the correct output response ("is fish") when presented different values for "has
fins" and "has gills" at the input layer neurons.
More details on the XML format for use in Backprop to describe network architectures is provided
later in this document (see "Network Architecture Language", below).
By convention, architecture files are stored on disk in files with a ".net" suffix, for example,
"mynet.net" is a backprop architecture file.
To load an architecture file, select Open... from the File menu. All the files in the current
directory with a suffix of ".net" will be displayed. Click on the file and hit OK. Backprop
will load the architecture file and display a graphical representation of the network. Note that
lines connect each node in the input layer to the nodes in the first hidden layer, each node in
the first hidden layer to the second hidden layer, and so forth.
Modifying the Neural Network
----------------------------
Starting with version 0.9.5, you can modify the topology of a neural network, and save the results,
in XML, to disk. To do this, position your mouse over a neuron, and click the right mouse button.
A popup menu will display, with 4 menu items: Insert Layer, Insert Neuron, Delete Layer, and Delete
Neuron. These menu items are described in the following sections.
Inserting Layers
----------------
The Insert Layer menu is a pullright menu, clicking it will cause a new menu to display. The menu
contains two menu items: After and Before. Selecting After will cause a layer with 1 neuron to be
inserted after the layer containing the neuron your mouse was positioned over when you clicked the
right mouse button. Alternately, selecting before will cause the layer to be inserted before the
layer containing the neuron you clicked over.
Inserting Neurons
-----------------
To insert a neuron in a layer, position the mouse over any neuron in the layer you want to insert
a neuron to, click the right mouse utton, and select the Insert Neuron menu item.
Deleting Layers
---------------
To delete a layer, position the mouse over any neuron in the layer you want to delete, click the
right mouse button, and select the Delete Layer menu item.
Deleting Neurons
----------------
To delete a neuron, position the mouse over any neuron in the layer from which you want to delete
a neuron, click the right mouse button, and select the Delete Neuron menu item.
Creating a New Neural Network
-----------------------------
Starting with 0.9.5, you can also create new neural networks graphically, and save the results to
an XML file of your choosing. Simply select "New" from the File menu. A 2 layer neural network,
containing a single neuron in each layer, is created. You can add layers and neurons as described
above in "Inserting Layers" and "Inserting Neurons".
Saving Your Changes
-------------------
Save and Save As... menu items in the File menu were added in 0.9.5. Use these to save your network
architecture and training settings to an XML file. These menu items will prompt you for the name
and location of the file.
Training the Network
--------------------
The next step is to train the neural network to solve a problem. This is done by selecting
"Train..." from the Network menu. A dialog will display, asking you to specify an exemplar file.
Type in the path of the exemplar file, or click the "Browse" button to navigate the file system in
search of one. By convention, exemplar files are given the same name as the architecture file, but
have a ".exm" suffix. For example, "mynet.exm" would be the exemplar file for the network defined
in the architecture file named "mynet.net".
The exemplar file (as of 0.9.5) is specified in XML. An exemplar file corresponding to the
"Has Fins, Has Gills, Is a Fish" problem described above might look like this:
This file contains 3 exemplars. The tag is required, and wraps the exemplars that
are specified by the file. An tag defines each exemplar, and it, in turn, wraps
and