Search
Program:
Downloads:
Likely, you will not manage to finish the implementation of all the functions during the excercise in the lab. Finish them as a home work.
Download the Netlab toolbox, unpack it to a directory, and set the path to the directory in MATLAB.
mlp()
netopt()
mlpfwd()
Repeat the task from the last week: train a simple neural network (2,2,1) on the wedge dataset.
For plotting, you can use the following code snippets. For the decision boundary:
%% Plot the decision boundary % Assuming the data are already plotted in current figure. % Get the current axis limits ax = axis; % Prepare the mesh of points we will use to test the network myx = ax(1):(ax(2)-ax(1))/100:ax(2); myy = ax(3):(ax(4)-ax(3))/100:ax(4); [xx,yy] = meshgrid(myx,myy); % Prepare the data to the right format data = [xx(:) yy(:)]; % Ask the NN for predictions pred = mlpfwd(net, data); % Reshape the predictions to the original matrix size pred = reshape(pred, numel(myx), numel(myy)); % Draw the contour line - the decision boundary [foo,c] = contour(myx, myy, pred, [0.5 0.5]);
And for the network response (assuming myx, myy, and pred come from the previous code snippet):
myx
myy
pred
surf(myx, myy, pred); shading flat; view(-10,80);
Use the XOR dataset and explore the results of (2,2,1) network for this data set.
Try to set higher number of units in the hidden layer.
axis([-1 2 -1 2])
axis([-10 11 -10 11])