资源简介
蚁群算法的特征选取matlab实现,是一种智能优化算法的应用

代码片段和文件信息
clc;
clear;
mydata=importdata(‘d:\matlab7\work\test3.dat‘);
RHO=corr(mydata);
R=abs(RHO);
n=30; % The number of features without class
m=3; % The number of selected features
CrossOverProb=0.9; % The Cross Over Probability
MutationProb=0.04; % The Mutation Probability
Population = 500; % The Size of popuation
GenerationNo = 300; % The Number of generation
%[N m TOWNS] = setup16;
%trail = N.*ones(N);
na = 200;
cc = 1;
for i=1:n
trail(i) = cc;
deltatrail(i) = 0;
end;
maxnoiteration = 20;
k = 50;
p = 1;
rho = 0.75;
alpha=1;
beta=1;
counter=1; % The First iteration
for j=1:na
Select = randperm(n);
s(j1:m)= Select(1:m);
end
data = dataset(mydata(:1:n)mydata(:n+1));
[TrainTest]=gendat(data0.6);
for j=1:na
A = [];
B = [];
for i=1:m
A = [ATrain(:s(ji))];
B = [BTest(:s(ji))];
end
W=knnc(A);
D=B*W;
E(j)=D*testc;
% scatterd(A);
% plotc({W});
end
[MinErrorMinErrorIndex]=min(E);
[SOIX]=sort(E);
for j=1:k
for l=1:m
for i=1:n
deltatrail(i)=0;
if (s(IX(j)l)==i)
Errorg = max(SO(1:k))-E(IX(j));
Errorhg=0;
for h=1:k
if ( (max(SO(1:k))-E(IX(h))) > Errorhg )
Errorhg = max(SO(1:k))-E(IX(h));
end
end
if (Errorhg ~= 0)
deltatrail(i)=Errorg/Errorhg;
else
deltatrail(i)=1;
end;
end;
trail(i)= rho * trail(i) + deltatrail(i);
end;
end;
end;
%for j=1:na
% temp1(1:m)= s(IX(round(rand*(k-1))+1)1:m);
% r=randperm(m);
% for l=1:m-p
% temp2(l)=temp1(r(l));
% end;
% s(j1:m-p)=temp2(1:m-p);
%end;
%tourlength = [];
%temp_length = [];
%rho = 0.5; % rho = 1 - (evaporation of trail)
%Q = N;
%avgtour = [];
%mintour = [];
while ( (counter < maxnoiteration) & (MinError > 0.001) )
counter = counter+1;
%for exit_tours = 1:40 %Loop back to here
%tabu = zeros(mN); %generate (N x m) matrix containing zeros
%set initial town for each ant randomly
%for i = 1:m
%tabu(i1) = ceil(N*rand);
%end
%Use function nexttown.m to determine next town based on visibility and
%trail
%for j = 1:length(TOWNS(1:))-1 %for each town
%for i = 1:m %for each ant
%sub_tabu = tabu(i:); %create tabu for each ant
%add new town to tabu using function nexttown.m
%tabu(ij+1) = nexttown(sub_tabu TOWNS trail);
%end
%end
for j=1:na
temp1(1:m)= s(IX(round(rand*(k-1))+1)1:m);
r=randperm(m);
for l=1:m-p
temp2(l)=temp1(r(l));
end;
s(j1:m-p)=temp2(1:m-p);
end;
for mm = m-p+1:m
for j=1:na
for i=1:n
flag=0;
for l=1:m-p
if (s(jl)==i)
flag=1;
end;
end;
if (flag==1)
USM(i)=0;
else
den=0
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7290 2011-06-05 07:19 ACO_feature_selection.m
文件 1338 2011-06-05 07:19 license.txt
- 上一篇:单脉冲测向单目标
- 下一篇:几种Matlab的边缘分割处理代码
相关资源
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
- k近邻算法matlab实现
- matlab识别系统
评论
共有 条评论