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

📄 nrs_fw_fs.m

📁 Neighborhood rough set based heterogeneous feature subset selection
💻 M
字号:
function [feature_slct,dependency, sig]=NRS_FW_FS(data_array,delta,efc_ctrl,fun_dpd)
%Discription:featureselect_FW_fast.m, A greedy feature selection for heterogeneous features based on neighborhood rough sets
%dependency: the dependency of each single feature
%sig:the significance of the selected features。
%data_array:Input data with decision ranked in the last column
%delta:the size of neighborhood. Generally speaking, delta=[0.1,0.2]
%efc_ctrl:The threshold to stop the search. The search is stoped if the increment introduced with every new feature is less than efc_ctrl.  
%fun_dpd:This parameter selects the strategies of computing attribute significance. 
%fun_dpd should be cited with single quotation marks,for example, 'clsf_dpd_fast'.
% For technique details, please refer to  
% Q.H. Hu, D.R. Yu, J. Liu, C. Wu. Neighborhood rough set based heterogeneous feature subset selection. Information Sciences.178(2008)3577-3594

[m,n]=size(data_array);
feature_slct=[];
efficiency=0;
feature_lft=(1:n-1);
sample_lft=(1:m);
sample_all=(1:m);
smp_csst_all=[];
array_cur=[];
num_cur=0;
while num_cur<n-1 
    if num_cur==0
        array_cur=[];
    else
        array_cur(:,num_cur)=data_array(:,feature_slct(num_cur));%将新选中的属性对应数据列加到原有表中
    end
    %开始进行组合
    dpd_tmp=[];
    smp_csst_tmp=[];
    for i=1:length(feature_lft)
        array_tmp=array_cur;
        array_tmp(:,[num_cur+1,num_cur+2])=data_array(:,[feature_lft(i),n]);
%%%%%%%%%%%%%%%%%%%%%Select different cases for different speed and distances%%%%%%%%%%%%%
        switch fun_dpd
            case 'clsf_dpd_fast'      %finish diatance computation,2-norm distance----faster
                [w,e]=clsf_dpd_fast(array_tmp,delta,sample_lft);
            case 'clsf_dpd_fast2'     %not finish diatance computation,2-norm distance----fastest
                [w,e]=clsf_dpd_fast2(array_tmp,delta,sample_lft);
            case 'clsf_dpd'           %for comparison 2-norm distance----slow
                [w,e]=clsf_dpd(array_tmp,delta,sample_lft);
            case 'clsf_dpd_fast_3'    %,infinite-norm diastance
                [w,e]=clsf_dpd_fast_3(array_tmp,delta,sample_lft);
        end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%继续        
        dpd_tmp(i)=w;
        if length(e)~=0
            smp_csst_tmp(i,(1:length(e)))=e;
        end
    end
 %%%%%%%%%%%%%%%return dependencies of single features%%%%%%%%%%%%%%%%%%%%%%%  
 if num_cur==0
     dependency=dpd_tmp;
 end
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    [max_dpd,max_sequence1]=max(dpd_tmp);
    if num_cur>0 & dpd_tmp<efc_ctrl
        num_cur=n-1;
    else
        if max_dpd>0 | num_cur>0
            if num_cur==0
                efficiency(1)=max_dpd;
            else
                efficiency(num_cur+1)=efficiency(num_cur)+max_dpd;
            end
            feature_slct(num_cur+1)=feature_lft(max_sequence1);    
            if length(smp_csst_tmp)~=0
                smp_csst_all=[smp_csst_all,smp_csst_tmp(max_sequence1,:)];
            end
            sample_lft=sample_all;
            sample_lft(smp_csst_all)=[];
            feature_lft(max_sequence1)=[];
            num_cur=num_cur+1; 
        else
            num_cur=n-1;
        end
    end
end
sig=efficiency;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -