⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sgnt_o.m

📁 用matlab编写的基于自生成神经网络(self-generated neural network)的预测方法(包含数据集)
💻 M
字号:

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

M=71;
N=1;
%********************************************
%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
wis(:,i)= tax(:,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

[nr,nc]=size(Y);

%********************************************************
% training process
%***********************************************************
tic;CPUTIME=cputime;
%************************************************
nodeY= sgnt_generating(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 + -