Assignment 3

Pattern Classification
Fredrik Georgsson

It is possible to do this assignment in pairs of two persons.

Last day to hand in a written report on the assignment is January 9th 2006!


The Task

The aims of the assignment are to learn how to use the MatLab Neural Network toolbox and get a deeper understanding of different aspects of neural networks.

Problem 1:
Implement a function that generates d-dimensional data sets drawn from two normal distributed classes according to

[features,targets,bayeserr]=gen_data(mu1,mu2,S1,S2,P1,N)
Where mu1 and mu2 are d-dimensional expected values, S1 and S2 are dxd-covariance matrices, P1 is a prior probability for class 1 and N is the number og observations that shall be generated. Features is a dxN matrix with observations and targets is a 1xN class membership vector with values 0 and 1. bayeserr is the probability that an observation is miss-classified with the given parameters.

Use the mvnrnd function to draw observations from a normal distribution. The Bayes-error is estimated by constructing a discriminant function (according to chapter 2.6.3 in Duda-Hart-Stork) based on the true parameters and use this to classify a large number of observations drawn from the distributions defined by the same parameters.

Problem 2:
Implement a function that find the optimal topology (i.e. the number of hidden nodes). Use the train function with early stopping to train the network with different numbers of hidden nodes. The set of hidden nodes to test over is to be taken as input to the function. Remember that the random initialization of the weights will produce a spread in the number of optimal hidden nodes. You should take this into account.

Problem 3:
Generate data sets with different Bayes error. Use your function (from paroblem 2) and evaluate how

  • the number of hidden nodes depends of the Bayes error.
  • how the generalization error depends on the number of hidden nodes.
  • how the training error depends on the number of hidden nodes.
  • Graphs of plots should be included in the report.

    Problem 4:
    Use the tricky data set from assignment 1 and construct the best neural network (i.e. with the lowest generalization error) you can for this particular data set.