Lecture 10 - Supervised Learning in Neural Networks - (Part 3)
Lecture 10 - Supervised Learning in Neural Networks - (Part 3)
Qadri Hamarsheh
1
Dr. Qadri Hamarsheh
%Solution:
% Define the training inputs and targets
p = [0 0 1 1; 0 1 0 1];
t = [0 0 0 1];
% Create the backpropagation network
net = newff(minmax(p), [4 1], {‘logsig’, ‘logsig’}, ‘traingdx’);
% Train the backpropagation network
net.trainParam.epochs = 500; % training stops if epochs reached
net.trainParam.show = 1; % plot the performance function at every epoch
net = train(net, p, t);
% Testing the performance of the trained backpropagation network
a = sim(net, p)
>> a = 0.0002 0.0011 0.0001 0.9985
>> t = 0 0 0 1