Aim | Specification | Configuration Schema | Resources
Assessment | What to Submit | How to Submit | Extra question for COMP9844 students | Due Date
The aim of this assignment is for you to:
You will use the xtlearn
NN simulator to configure
and train a simple recurrent network. The network will be trained to
predict the value of Woolworths stock market shares.
The file orig_data.txt (graph) contains the 36 months' worth of data - one row for each month. The first column is the value of the stock on that month. The second column is the value of the "Retail" index on that month. Both columns have been normalised such that on month 1 the value is $100. You will note that as time progresses (down the list), the value of the stock and the index fluctuates.
The problem for the neural network is, "Given the current month's stock value and retail index value, what is the stock value for the next month?" Using our data file this can be obtained by looking at the next row. In other words, the target values for the network are those given in file orig_teach.txt. You will note that we only have 35 months worth of target values as we do not know the value of the stock or index on month 37. This implies we can only train the network on the first 35 months worth of data.
Now, the numbers in the two data files are not suitable for training a neural network in their current form. Your first task is to design a suitable encoding scheme and translate the two files accordingly.
As an example translation, you could encode the number using binary notation. In that case the translated data could be as in these data and target files. Note that this is an example only. These files may contain mistakes and you may consider this encoding scheme to be unsuitable! You will be marked on your justification of the choice of representation that you make - there is no one right answer.
For this assignment you will be using a Elman (= simple recurrent) network. Consequently, the network will have:
Once you have designed your network you will need to use
tlearn
to create it. The following assumes that you have
access to tlearn
(see Resources
below). Note that different implementations of tlearn
have different menu structures so you will have to explore to become
familiar with it.
Using the tlearn
menu, create a new project and call it
"wow"
. This will create a file called wow
in your current directory:
The .cf
,
.data
, and .teach
files
are created and edited with a regular text editor.
The project file wow
is affected by the changes
that you make in the options dialogues in xtlearn
.
The wow.cf
file will be used to define the neural network. The file
wow.data
will contain the encoded input data
and wow.teach
will contain the encoded target
patterns.
The specification in the wow.cf
file is a little complicated due to the flexibility provided by tlearn
. To simplify this process, a schematic configuration is provided below.
The first two lines of the wow.data
and
wow.teach
files need to specify the format of the data. This
can be done using the following:
distributed
35
This says that the input is a set of 35 vectors. The remaining 35 lines should be your encoded data - one line per month.
Ensure the project files are saved then use the tlearn
menu "Training Options..." to access the training options
dialogue. Select a suitable training rate and momentum and ensure
"Train Sequentially" is selected. The "Training Sweeps" parameter
sets the number of sweeps to perform for training, where
processing one input pattern is a sweep (i.e. 35 sweeps to a epoch).
Use the tlearn
menu to train the network. This will
generate an error log file and one or more weights files. You can
also watch the progress of the training by showing various windows.
More details on error logging in the
xtlearn tutorial. You have have to hand in an error log as
part of the assignment submission: please don't submit a huge
error log - just a reasonable sample of error - maybe 100-200 lines
long. To do this, you need to adjust the logging interval - if you
train your simulation for 35000 sweeps (say), then to get 200 lines
of error log, you would need to have set the logging interval to
35000/200 = 175. It is a good idea to set the logging interval to
a multiple of the number of training patterns. The marker has
better things to do than scroll through 150,000 lines of error log,
and may not feel friendly if you make him do so.
Note:
xtlearn appends error values to an existing .err file. Thus you should
remove/delete your .err file before your final run, so that the .err
file that is created in your final run consists only of the error
values from that final run. It's smart to check how many lines are
in the file before you submit it, e.g. by doing wc -l *.err
(in a Unix/Linux environment), or similar. In fact, you could
actually look at what's in the .err file before you submit it.
When you are happy with the training, you can use the network
to generate stock market predictions. To make predictions from the
wow.data
file select the menu option, "Verify network has
learned". You can use the "Testing Options" dialogue to send the output
to a file. The output must be translated using your decoding scheme to
obtain the predicted stock values. How good are the predictions? Why
do you think your network has obtained these results? What value does
your network predict for the unknown 37th month? What trade-offs are
being made by your design decisions?
It is likely that your results inspire changes in either the encoding scheme, network design or training regime. You should document the different approaches you take and include them in your assignment report. Evidence of intelligent experimentation will be rewarded.
The following is a schematic configuration file to
implement an Elman network using tlearn
. To
form a complete network specification, replace the variables
with actual
numbers. (Note that the hyphens in the schema are not minus signs
and need to be in the configuration file!)
NODES: nodes = N inputs = I outputs = O output nodes are X-Y CONNECTIONS: groups = 0 1-Y from 0 1-H from i1-iI Z-N from 1-H = 1. & 1. fixed one-to-one 1-H from Z-N X-Y from 1-H SPECIAL: linear = Z-N weight_limit = 0.5
Where
I = number of input units
H = number of hidden units
C = number of copyback units
O = number of output units
X = H + 1
Y = H + O
Z = H + O + 1
N = H + O + C
If you choose to do this assignment on the school computers, then tlearn
can be run using
~cs9444/bin/xtlearn
or as described on the COMP9444 home page. If you prefer to
use your own copy of xtlearn
, then you can get it using
the links on the
COMP9444/9844 home page.
You also may want to refer to the following:
tlearn
user manual (as a postscript file - 40 pages)If you download the Windows version from the tlearn home page, be aware that it has a bug in the way it does error logs. This means that if you use the Windows version to do your assignment, you will still need to do your final run that produces the error log that you will submit. The nature of the bug is this: while the error graph looks fine, the error log consists of only a single error value, rather than a list of them. If uncertain, open the error log (it's a text file) and have a look at how many error values are there.
This assignment will contribute 10% of your final mark (subject to the assessment scheme).
You will be assessed on the following points:
tlearn
It will help your case greatly if your submission is easy to read. With this in mind be careful how you format results! Watch out for tabs, line wraps and DOS control codes.
Remember, you will be assessed on the depth of your understanding and the ability to communicate that, not on the volume of work submitted!
You will need to submit a number of files using the give
system. The files to submit are:
|
The configuration file used to define the network. |
wow.data |
The file containing the encoded training data. |
wow.teach |
The file containing the encoded target patterns. |
wow.err |
The training error output file. |
wow.txt |
A text file containing:
The text file isn't very pretty, but it lets me mark it, comment it, and return it to you conveniently with the available marking software. Please keep the lines in your wow.txt report to a maximum of 100 characters. The marking software doesn't automatically fold lines :-( |
Using your chosen input and output encodings as above,
compute how many weights and biases your network uses.
Document this in your wow.txt
report.
Design a two-state Elman tower network that has approximately
the same number of weights and biases as your one-state Elman
network.
Document this in your wow.txt
report.
Train this network using the same data. How many
epochs does it take to train to the same level of error?
Report on this, and anything else interesting that you notice,
in your wow.txt
file. Also include in your
wow.txt
the contents of the .cf
file for your two-state Elman tower.
On a CSE school computer:
wow.cf
, wow.data
,
wow.teach
, wow.err
and wow.txt
are in your current directory
give cs9444 wow wow.cf wow.data wow.teach wow.err wow.txt
classrun -check wow
give cs9444 ...
- not cs9844
as you might have expected.
You are able submit multiple times. Only the last submission will be assessed.
Friday of week 8 (11:55pm, 20 September 2013).
This assignment specification is © Copyright 2013, Bill Wilson and the University of New South Wales, Sydney, Australia.