Question
3. Consider a two-dimensional class problem that involves two classes wi (+1) and w₂ (-1). Each one of them is modeled by a mixture of equiprobable Gaussian distributions. Specifically, the means of the Gaussians associated with w₁ are [55] and [55], whereas the means of the Gaussians associated with w₂ are [-5 -5], [00], [55]. The covariance matrices of all Gaussians are an identity matrix I. (a) Generate and plot a data set X₁ (training set) containing 100 points from w₁ (50 points from each associated Gaussian) and 150 points from w2 (again 50 points from each associated Gaussian). In the same way, generate an additional set X2 (test set). (b) Based on X1, train a two-layer neural network with two nodes in the hidden layer, each one having the hyperbolic tangent as activation function and a single output node with linear activation function, 10, using the standard back- propagation algorithm for 9000 iterations and step size equal to 0.01. Compute the training and test errors, based on X1 and X2, respectively. Also, plot the test points as well as the decision lines formed by the network. Finally, plot the training error versus the number of iterations. (This plot is similar to figure (a) (b) on Slide 51 of Lecture 5.) (c) Repeat (b) for step size equal to 0.0001 and comment on the results. Hint: Use different seeds in the rand (MATLAB) function for the train and the test sets. To train the neural networks, use the newff (MATLAB) function. To plot the decision region performed by a neural network, first determine the boundaries of the region where the data live (for each dimension determine the minimum and the maximum values of the data points), then apply a rectangular grid on this region, and for each point in the grid compute the output of the network. Then draw this point with different colors according to the class it is assigned to (use, e.g., the "magenta" and "cyan" colors).
Question image 1