• 大小: 7KB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2021-06-17
  • 语言: Matlab
  • 标签:

资源简介

一款不错的目标特征提取的程序,由于MATLAB简单易学,所以此程序比较简单易懂,便于特征提取实用

资源截图

代码片段和文件信息

%----4.18编 增 l减 r法  特征选择 
clear;
clc;
%--------特征导入  请自行修改
M=256;N=256;
load coourfeature_0420_FGL-5 %%%共生矩阵 96.14%
feature{1}=coourfeature(:1);
feature{2}=coourfeature(:2);
feature{3}=coourfeature(:3);
load fufeature_0420_FGL-5 %%复小波  98.26%
for i=1:13
    feature{3+i}=wavefeature(:i);
end
load wavefeature_feixia_0420_FGL-5%%%非下采样小波  97.58%
for i=1:7
    feature{16+i}=wavefeature(:i);
end
load wavefeature_0420_FGL-5%%小波 97.65%
for i=1:7
    feature{23+i}=wavefeature(:i);
end
%%%%%%%----------归一化
[m n]=size(feature{1});
for j=1:30%一共30组特征 这里 请自行修改
    mx=max(feature{j});
    mi=min(feature{j});
    mxx=(mx-mi);
    mii=ones([m n])*mi;
    feature{j}=(feature{j}-mii)./mxx;
end
%-------------------------特征选择开始啦!!
%-说明:本算法是l>r就是自下而上的计算

l=4;r=3;d=1;%d 是最终要得到的特征数 l是每次增加的特征 r是每次减去的特征 
chosen=[];%%表示已选的特征
chosen=[chosen 1];
while d<12
    %-----------------------------1 选l个特征-------------------------------------
    for j=1:l   %选l个特征
        J=zeros([1 30]);
        for i=1:30  %%一共30组特征 这里 请自行修改 
           [mm nn]=size(chosen);
            for p=1:nn
                 if i==chosen(p)
                    J(i)=0;
                    break;   
                 else
                      J(i)=J(i)-sum(sum((feature{i}-feature{chosen(p)}).^2));          
                 end
            end
        end
        mi=min(J);
        for i=1:30
            if J(i)==0
               J(i)=mi;     
            end
        end
        [ma1 we1]=max(J);
        chosen=[chosen we1];             
    end
%-----------------------------2 去掉r个特征-------------------------------------
   
    dele=[];
   for j=1:r   %%删r个
       [ch chnum]=size(chosen);
      J=zeros([1 chnum]);ii=0;  
      for i=1:chnum  %     去掉chosen中第i个的效果
      [mm nn]=size(chosen);
        for p=1:nn
            
            
              for q=1:nn    
                  if (chosen(q)~=chosen(i)) & (chosen(p)~=chosen(i))             
                    J(i)=J(i)-sum(sum((feature{chosen(q)}-feature{chosen(p)}).^2));  
                  end
              end
           
        end
      end
%        mi=min(J);
       for cc=1:chnum
            if J(cc)==0
                J(cc)=mi;
            end
       end
       [ma we]=max(J);  
        chosen(we)=[];
                
    end
    d=d+l-r
end

[mm nn]=size(chosen);
tezh=[];
for i=1:nn
    tezh=[tezh feature{chosen(i)}];
end
% %%%%%%%%聚类
% [IDCU]=kmeans(tezh4);
%        cc(IDC==11)=0;
%        cc(IDC==21)=0.25;
%        cc(IDC==31)=0.5;
%        cc(IDC==41)=0.75;
% % g=reshape(ccMN); 
% %  figureimshow(g);
%  save 0423gFGL g





 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2007-12-25 13:49  feature_selection7777\
     目录           0  2006-12-04 21:24  feature_selection7777\feature selection\
     文件        2842  2006-12-04 21:21  feature_selection7777\feature selection\pluslr.m
     文件        2221  2006-12-04 21:23  feature_selection7777\feature selection\sbs.m
     文件        3462  2006-12-04 21:22  feature_selection7777\feature selection\sffs.m
     文件        1803  2006-12-04 21:23  feature_selection7777\feature selection\sfs.m
     文件        1223  2007-11-29 11:22  feature_selection7777\说明.txt

评论

共有 条评论

相关资源