Reference no: EM132272064
Assignment
Aim:
This assignment is intended to provide basic experience in writing neural network applications and conducting classification experiments with MLPs. After having completed this assignment you should know how to implement a back propagation multi-layer neural network which can be used for a variety of classification tasks.
Assignment Specification:
Your main task in this assignment is to implement selectable ordering of the training data and make the net more powerful by enabling the MLP to be configured as a 3-, 4- or 5-layer MLP with a specified number of neurons in each layer and to use the MLP to classify all the given data. You are to also provide a test function so that the MLP can learn training data and be tested with different test data. For this assignment you can write and compile your code on PC or UNIX platforms. To complete this assignment, it is recommended you follow the steps below.
Step 1: To improve MLP training, implement an option for providing selectable ordering of the training data. The "Ordering" parameter should be added to the definition header of the training data files after ObjErr. e.g.:
. . .
Mtm1 : 1.2
Mtm2: 0.4
ObjErr: 0.005
Ordering: 1
. . .
"Ordering" determines which training pattern is selected each training iteration (epoch). The options are:
0 Fixed Always uses the same given order of training patterns.
1 Random Make completely different (random) order at each epoch (i.e. new permutation).
2 Random Swap Random permutation at start. After each epoch, two patterns are randomly selected and exchanged.
Tip: Try using an index array to rearrange the selection order.
Step 2: Implement 4- and 5-layer neural networks (i.e., have 2 and 3 hidden layers, respectively) trained with the back propagation algorithm by modifying the code in mlp.cpp. To do this rename the TrainNet() function to TrainNet3() and make modified copies of this function (named: TrainNet4() and TrainNet5()) with 4- and 5-layers respectively. Then incorporate a switch statement into your code so that the appropriate TrainNet() function is invoked according to the data specs. Test your completed code on the provided data and ensure that the MLP configuration in the data files (i.e., the number of layers, number of neurons, etc.) is being complied with.
Step 3: Write a TestNet() function that tests the MLP's performance by using the MLP trained with the training data to classify the test data in the data files and report the error rate. A typical run of you MLP should look like:
NetArch: IP:8 H1:5 OP:1
Params: LrnRate: 0.6 Mtm1: 1.2 Mtm2: 0.4
Training mlp for 1000 iterations: #
1:
2:
3:
4:
5:
6:
7:
8:
. . . .
1000:
Testing mlp:
MinErr AveErr MaxErr %Correct
0.001126 0.008256 0.015060 10.1607
End of program.
Step 4: Your task here is to devise various back-propagation neural network of minimum size (in terms of the number of neurons in the MLP) that can correctly classify the Two Spiral Problem (data1.txt) and the other data sets associated with Problems 2 and 3 (see below). Note: the data for problems 2 and 3 may need extra work, like normalizing the data, dividing it into training and test data and adding the MLP header information. You should experiment with various MLPs with variations in the numbers of layers, number of neurons in each layer, parameters (e.g., learning rate and momentum) and the number of training iterations. If you are unable to classify all the data correctly, then your final MLP configuration should be a best case compromise between size and performance. For each data set you must write a report comprised of the following information with the given headings:
1) About the problem
A brief description of the problem.
2) On the various MLPs experimented
A report of the various MLPs (at least 3 MLPs) that you experimented with including any parameter changes you made and the results that were achieved. Try running each MLP a few times to determine if the problem has local minimums. If so state this in the report and see if this can be avoided by increasing the momentum. You should also indicate the approximate architecture that you think is most suited for the problem and how long and the number of epochs it takes to learn the data. (e.g., "... the best MLP for the problem appears to be a network with a large number of hidden layers with few nodes in each layer..."). Use graphs if you think this is helpful in understanding the performance differences of the various MLPs.
3) On the final MLP's architecture
Report on the final MLP that you consider is either the one that classifies all the data correctly or is a best case compromise between size and performance. Provide a description of the final MLP architecture together with a drawing of the MLP.
4) On the final MLP's performance
Write a brief summary of the final MLP's performance. Also, provide a graph showing the epochs vs error rate. (Note: for binary classification problems, the error rate should indicate the percentage of patterns correctly classified on the training and test data.) Was the final MLP able to learn all the training data and classify the test data correctly? If not, why not? Are there local minimums with this MLP?
Attachment:- Assignment.rar