✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab仿真内容点击👇
⛄ 内容介绍
特征选择问题是从数据集中找到最优特征子集的预处理机制之一。当特征数量增加时,问题的搜索空间将呈指数级增长。因此,特征选择问题被归类为 NP-hard 问题,精确的算法无法在合理的时间找到最优子集。因此,元启发式算法等近似算法被广泛应用于解决该问题。特征选择问题是一个离散(二元)优化问题;因此,可以使用离散元算法来找到最佳的特征子集。最近引入的元启发式算法之一是海洋捕食者算法 (MPA),它已经显示出对许多连续优化问题的良好解决方案。引入了一种使用时变正弦和 V 形传递函数 (BMPA-TVSinV) 的新型二元海洋捕食者算法,以查找数据集中的最佳特征子集。所提出的算法应用两个新的时变传递函数将连续搜索空间转换为二进制搜索空间。这些传递函数显着提高了 BMPA-TVSinV 的特征选择性能。COVID-19 数据集用于显示 BMPA-TVSinV. 在问题中的效率。
⛄ 部分代码
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Z. Beheshti, BMPA-TVSinV: A Binary Marine Predators Algorithm using time-varying sinus and V-shaped transfer functions for
% wrapper-based feature selection, Knowledge-Based System (2022) 109446.
% doi:https://doi.org/10.1016/j.knosys.2022.109446.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
% warning off; %#ok
%
clc
close all
clear all %#ok<CLALL>
global A train_data test_data;
%%
% Dataset
A=xlsread('COVID19_II_r.csv'); CaseName='COVID19(II)';
%%
N=30; %Poulation Size
max_it=100; %Maximum Number of Iteration
p=size(A,2)-1; % The number of attributes
%%
r=randperm(size(A,1));
train_data=r(1:floor(length(r)*0.8)); % Training Set= 80%
test_data=r(floor(length(r)*0.8)+1:end); % Testing Set=20%
%%
disp('************** BMPA-TVSinV **************');
[BestChart,BestFitness,Error,BestPosition]=BMPA_TVSinV(N,max_it,p,'Fitness');
q=sum(BestPosition,2); % Selected Feature
disp(['Accuracy BMPA-TVSinV:',num2str((1-Error)*100), ' #Selected Features=',num2str(q) ,' #Best Fitness=',num2str(BestFitness)]);
%% Plot
figure
maxit=1:1:max_it;
plot(maxit,BestChart, '-','LineWidth',2);
legend('\fontsize{10}\bf BMPA-TVSinV');
xlabel('\fontsize{12}\bf Iteration');
ylabel(['\fontsize{11}\bf Fitness for ',CaseName,' Dataset']);
⛄ 运行结果
⛄ 参考文献
Z. Beheshti, BMPA-TVSinV: A Binary Marine Predators Algorithm using time-varying sinus and V-shaped transfer functions for wrapper-based feature selection, Knowledge-Based Systems (2022) 109446. doi:https://doi.org/10.1016/j.knosys.2022.109446.