Do the following, integrate the results in a Word document. The document should be well formatted mixing the graphs and explanations as requested in the assignment, with ABSOLUTELY NO handwritten or hand drawn items.
Matlab Issues
You can use the norm command to get the norm of a matrix or a vector.
To get the largest floating point number representable on this computer use realmax. Anything larger than realmax causes an overflows. This value can be useful if you are trying to initialize a variable (such as an error which you expect to fall) with a really large number.
To perform operations on an array element by element you can use the array multiply (.*), array power (.^), and array divide (./ and .\)operators.
If you want to improve the readability of your graphs you can try using the grid command.
Matlab Assignment
1) Do problem 3.5 from the textbook. Do only part 1 steps a) and b). Note that a network with one hidden layer has a total of two layers. Implement training using a function such as bp2 below, and evaluation of network output using a function such as bp2val below. To show the performance of the network show the graph of the Mean Square Error (MSE) as a function of the number of training epochs (use log scale for the MSE axis of the plot). Show the difference between the actual network outputs and the function values in another plot. Since the output of the network's hyperbolic tangent activation function is limited between –1 and 1, the data needs to be scaled appropriately. For example at the network's output you will need to represent 1/0.1 = 10 with a value between -1 and 1. You can use M = 10 neurons in the hidden layer.
function [W1,W2,E] = bp2(Ptrain,Ttrain,Ptest,Ttest,M,Tp,W1,W2);
%
% BP2 - MLP NN with one hidden layer trained using backpropagation
%
% [W1,W2,E] = bp2(Ptrain,Ttrain,Ptest,Ttest,M,Tp,W1,W2);
%
% Ptrain - n by N matrix with N, n-dimensional training input vectors
% Ttrain - m by N matrix with N, m-dimensional training output vectors
% Ptest - n by Q matrix with Q, n-dimensional testing input vectors
% Ttest - m by Q matrix with Q, m-dimensional testing output vectors
% M - number of neurons in the hidden layer
% Tp - training parameter vector
% Tp(1) - learning rate
% Tp(2) - maximum number of iterations
% Tp(3) - slope of the activation function, f(x)=tanh(beta*x)
% Tp(4) - stopping condition; the learning is stopped if the error for
% testing data is increased by Tp(4)
% Tp(5) - if Tp(5) = 0 - random weights initialization;
% else use Nguyen - Widrow initialization
% W1 - weights from the input to the hidden layer (includes biases)
% W2 - weights from the hidden layer to the output (includes biases)
% E - learning history
function y = bp2val(P,W1,W2,beta);
%
% BP2VAL - output of the MLP NN with one hidden layer
%
% y = bp2val(P,W1,W2,beta);
%
% P - n by N matrix containing N, n-dimensional input vectors
% W1 - weights from the input to the hidden layer
% W2 - weights from the hidden layer to the output
% beta - slope of the activation function
% y - m by N matrix containing N, m-dimensional output vectors