1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| function annf1()
% load xb
% c1='C:\classe1.txt';
% c2='C:\classe2.txt';
% [x1]=annkmeans(c1,26);
% [x2]=annkmeans(c2,26);
% x1=xb(1:100,1:2);
% x2=xb(101:200,1:2);
% x1=randn(10,2);
% x2=rand(10,2);
% plot(x1(:,1),x1(:,2),'r*',x2(:,1),x2(:,2),'b+')
% n2=size(x2,1);
% n1=size(x1,1);
load xx
load y1
n2=size(y1,1);
n1=size(xx,1);
inputx=[xx];
outputy=[y1];
pt=inputx;
tt=outputy;
Num=length(tt);
niv=26; % number of input variables
nhn=200; % number of hidden neuron
nov=10; % number of output variables
f1='logsig'; % hidden layer transfer function
f2='purelin'; % output layer transfer function
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
net = newelm(minmax(inputx),[nhn nov],{'logsig','purelin'});
net.trainparam.epochs=500; %Max epoch number
net.trainParam.goal=1e-6;
net.trainParam.max_fail=15;
net.trainParam.show=500;
net=init(net);
% Training the Net
% ***********************************
net=train(net,inputx,outputy);
% Descaling data and calculating error
% ****************************************************
anst=sim(net,inputx);
%classe1
y1=anst(1:n1);
c1=find(y1>0.5);
Traine1=100*length(c1)/n1
%classe2
y2=anst(n1+1:n1+n2);
c2=find(y2<0.5);
Traine2=100*length(c2)/n2 |
Partager