1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| %Here is a problem consisting of inputs P and targets T to be solved with a network.
P = [0 1 2 3 4 5 6 7 8 9 10];
T = [0 1 2 3 4 3 2 1 2 3 4];
%Here a network is created with one hidden layer of five neurons.
net = newff(P,T,5);
%The network is simulated and its output plotted against the targets.
Y = sim(net,P);
plot(P,T,P,Y,'o')
%The network is trained for 50 epochs. Again the network's output is plotted.
net.trainParam.epochs = 50;
net.trainParam.showWindow = false;
net = train(net,P,T);
Y = sim(net,P);
%plot(P,T,P,Y,'o') |
Partager