Computational Intelligence, SS08 2 VO 442.070 + 1 RU 708.070 last updated:
General
Course Notes (Skriptum)
Online Tutorials
Practical Course Slides
Homework
 Assignments Scores Guidelines Archive
Exams
Animated Algorithms
Interactive Tests
Key Definitions
News
mailto:webmaster

# Homework 2: Neural Networks

[Points: 12.5; Issued: 2008/03/20; Deadline: 2008/05/16; Tutor: Robert Peharz; Infohour: 2008/05/09, 15:30-16:30, HS i11; Einsichtnahme: 2008/05/30, 15:30-16:30, HS i11; Download: pdf; ps.gz]

## Simple Regression with Neural Networks[4 points]

In this task a simple 1-dimensional function should be learned with feed-forward neural networks. Use the same data set as for homework 1.
• Train a neural network with neurons. Use the training algorithm 'trainscg', train for epochs.
• Plot the mean squared error of the training and of the test set for the given number of neurons. For the test set, plot the mean squared error (mse) after training ( ) and the minimum mse during training ( ).
• Interpret your results. Why is there a difference between and ? What is the best value of ?
• Plot the learned functions for , and . Interpret your results, refer to results from the previous plots!
• Compare the results to homework 1. Is there any connection of and ? [2 Extra-Points]

### Hints

• Normalize your input data using mapstd (in older Matlab versions (< 7.5) this function is called prestd)
• You can easily use the performance structure returned by the train function to get the error on the training and on the test set.

## Face Recognition with Neural Networks [8.5 points]

In this task you are ask to work with the dataset faces.mat which contains face images. The dataset contains images of different persons, with different pose (straight/left/right/up), with/without sunglasses and showing different emotions. Download the matlab dataset. It contains 2 datasets: dataset1 (input1, target1) with 60 data points and dataset2 (input2, target2) with 564 data points. The target matrices contain the class informations. The first column codes the person, the second column the pose, the third column the emotion and the last column indicates wether the person is wearing sunglasses. In template_faces.m you can find a script for training a sunglasses recognizer. This script can be used as template. Additionally you need to download the file confmat.m which is needed to calculate the confusion matrix.

### Pose Recognition

• Train a 2 layer feed-forward neural network ith 6 hidden units for pose recognition. Use dataset2 for training, trainscg as training algorithm and train for epochs. Do not use any test set.
• State the confusion matrix on the training set. Are there any poses which can be better separated than others?
• Plot the weights of the hidden layer for every hidden unit. Can you find particular regions of the images which get more weights than others? Do particular units seem to be tuned to particular features of some sort?

### Face Recognition

• Train 2 layer feed-forward neural network with 20 hidden units for recognizing the individuals. Use dataset1 for training, trainscg as training algorithm and train for epochs. Use dataset2 as test set.
• Repeat the process 10 times starting from a different initial weight vector. Plot the histogram for the resulting mean squared error (mse) on the training and on the test set.
• Interpret your results! Explain the variance in the results.
• Use the best network (with minimal mse on the test set) to calculate the confusion matrix for the test set and the mean classification error (not the mse !) on the test set. Plot a few missclassified images. Do they have anything in common?

### Hints

• Normalize your input data using mapstd (in older Matlab versions (< 7.5) this function is called prestd)
• In the template script you can find code for plotting an image and plotting the weights of a hidden neuron
• Be aware that the template script only covers the 2 class classification case !
• Use the functions full and ind2vec to get from the standard class coding to a 1 out of n coding.

### Remarks

• Hand-in your matlab code as print-outs (no emails !!).
• Present your results clearly, structured and legible. Document them in such a way that anybody can reproduce them effortless.
• Use your matrikel number to initialize the state of the random number generators.