?? sgnt1.m
字號:
close all
clear all
delta= 0.4;
% iris data set: Input dimmension M=4; Output dimmension: N=3
% Wisconsine Brests Cencer data set: Input dimmension M=9; Output dimmension: N=1
% taxdata data set: Input dimmension M=71; Output dimmension: N=1
% biotrain data set: Input dimmension M=74; Output dimmension: N=1
M=4;
N=3;
%********************************************
load iris_tr
Y= IRIS_training_data;
clear IRIS_training_data
%load taxdata
%[nr,nc]= size(tax);
%wis= tax;
%load wine_a
%Y=wine_a;
%clear wine_a
%load wisconsine
%[nr,nc]=size(wisconsin);
%for i=1:1:nc-1 wis(:,i)= wisconsin(:,i); end
%load biotrain
%yy = biotrain(:,2:75);
%yy(:,75) = biotrain(:,1);
%[nr,nc] = size(yy);
%for i=1:1:nc bio1(:,i) = yy(:,i); end
% ii=floor(nr/2);
% for i=1:1:ii Y(i,:)=wis(i,:); end
% for i=ii+1:1:nr S(i-ii,:)= wis(i,:); end
% clear wisconsin wis
%ii=15000;
%for i=1:1:ii Y(i,:) = bio1(i,:); end
%for i=ii+1:1:20000 S(i-ii,:)= bio1(i,:); end
%clear yy bio1
[nr,nc]=size(Y);
%********************************************************
% training process
%***********************************************************
tic;CPUTIME=cputime;
%************************************************
nodeY= sgnt_generating_online(Y,M+N);
%*******************************************************
TOC=toc;
CPUTIME=cputime-CPUTIME
%*********************************************************
% test process
%*********************************************************
load iris_te
S = IRIS_testing_data;
clear IRIS_testing_data
%load wine_b
%S=wine_b;
%clear wine_b
[sr,sc]=size(S);
tic;CPUTIME=cputime;
[nr,nc]= size(nodeY);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Err=0;
i5=1;
for j=1:1:sr
dmin= inf;
for i=1:1:nr
if nodeY(i,M+N+2) > 0
for k=1:1:M
w(k)= nodeY(i,k);
ss(k)= S(j,k);
end
d= (ss-w)*(ss-w)';
if dmin > d
dmin= d;
min= i;
end
end
end
for k=1:1:N
x1(k)= S(j,M+k);
x2(k)= nodeY(min,M+k);
end
ds= sqrt((x1-x2)*(x1-x2)');
if ds > delta
Err= Err+1;
c(i5)=j;
i5=i5+1;
end
end
accuracy= (1-(Err/sr))*100
Err=Err
TOC=toc;
CPUTIME2= cputime-CPUTIME
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -