💥1 概述
特征选择是当前信息领域,尤其是模式识别领域的研究热点。该代码演示了BGWO如何使用基准数据集Main解决特征选择问题。
📚2 运行结果
🎉3 参考文献
[1]童坤. 基于改进GWO算法的入侵检测特征选择研究[D].湖北工业大学,2019.
👨💻4 Matlab代码
主函数部分代码:
%% Binary Grey Wolf Optimization (Version 1) clc, clear, close % Benchmark data set load ionosphere.mat; % Set 20% data as validation set ho = 0.2; % Hold-out method HO = cvpartition(label,'HoldOut',ho,'Stratify',false); % Parameter setting N = 10; max_Iter = 100; % Binary Grey Wolf Optimization [sFeat,Sf,Nf,curve] = jBGWO1(feat,label,N,max_Iter,HO); % Plot convergence curve plot(1:max_Iter,curve); xlabel('Number of Iterations'); ylabel('Fitness Value'); title('BGWO1'); grid on; %% Binary Grey Wolf Optimization (Version 2) clc, clear, close; % Benchmark data set load ionosphere.mat; % Set 20% data as validation set ho = 0.2; % Hold-out method HO = cvpartition(label,'HoldOut',ho,'Stratify',false); % Parameter setting N = 10; max_Iter = 100; % Binary Grey Wolf Optimization [sFeat,Sf,Nf,curve] = jBGWO2(feat,label,N,max_Iter,HO); % Plot convergence curve plot(1:max_Iter,curve); xlabel('Number of Iterations'); ylabel('Fitness Value'); title('BGWO2'); grid on;