www.pudn.com > dbn.zip > bp.asv, change:2012-05-18,size:904b


%     * 
 
%       P = [0 1 2 3 4 5 6 7 8 9 10]; 
load traindata 
traindat=traindata(2:2:18000,:); 
trainlabel=label(2:2:18000,:); 
testdata=traindata(1:2:18000,:); 
testlabels=label(1:2:18000,:); 
      T = [0 1 2 3 4 3 2 1 2 3 4]; 
 
% A two-layer cascade-forward network is created with one hidden layer of five neurons. 
 
%     * 
 
      net = newcf(traindat',trainlabel',100); 
 
% The network is simulated and its output plotted against the targets. 
%  
%     * 
 
      Y = sim(net,testdata'); 
%       plot(P,T,P,Y,'o') 
 
% The network is trained for 50 epochs. Again the network's output is plotted. 
 
%     * 
      plot(Y,'*'); 
      hold on 
      plot(testlabels) 
      net.trainParam.epochs = 150; 
      net = train(net,traindat',trainlabel'); 
      Y1= sim(net,testdata'); 
      plot(Y1,'r-.') 
      Y2=Y1>1.5; 
      zz=sum(testlabels~=Y2); 
       
%       plot(P,T,P,Y,'o')