Gointerface接口声明实现及作用详解
259
2022-09-08
【DELM预测】基于风驱动算法改进深度学习极限学习机实现数据预测附matlab代码
1 简介
人工神经网络的最大缺点是训练时间太长从而限制其实时应用范围,近年来,极限学习机(Extreme Learning Machine, ELM)的提出使得前馈神经网络的训练时间大大缩短,然而当原始数据混杂入大量噪声变量时,或者当输入数据维度非常高时,极限学习机算法的综合性能会受到很大的影响.深度学习算法的核心是特征映射,它能够摒除原始数据中的噪声,并且当向低维度空间进行映射时,能够很好的起到对数据降维的作用,因此我们思考利用深度学习的优势特性来弥补极限学习机的弱势特性从而改善极限学习机的性能.为了进一步提升DELM预测精度,本文采用麻雀搜索算法进一步优化DELM超参数,仿真结果表明,改进算法的预测精度更高。
2 部分代码
%-------------------------------------------------------------------------tic; clear; close all; clc; format long g;delete('WDOoutput.txt'); delete('WDOpressure.txt'); delete('WDOposition.txt');fid=fopen('WDOoutput.txt','a');%--------------------------------------------------------------% User defined WDO parameters:param.popsize = 20; % population size.param.npar = 5; % Dimension of the problem.param.maxit = 500; % Maximum number of iterations.param.RT = 3; % RT coefficient.param.g = 0.2; % gravitational constant.param.alp = 0.4; % constants in the update eq.param.c = 0.4; % coriolis effect.maxV = 0.3; % maximum allowed speed.dimMin = -5; % Lower dimension boundary.dimMax= 5; % Upper dimension boundary.%---------------------------------------------------------------% Initialize WDO population, position and velocity:% Randomize population in the range of [-1, 1]:pos = 2*(rand(param.popsize,param.npar)-0.5);% Randomize velocity:vel = maxV * 2 * (rand(param.popsize,param.npar)-0.5); %---------------------------------------------------------------% Evaluate initial population: (Sphere Function)for K=1:param.popsize, x = (dimMax - dimMin) * ((pos(K,:)+1)./2) + dimMin; pres(K,:) = sum (x.^2);end%----------------------------------------------------------------% Finding best air parcel in the initial population :[globalpres,indx] = min(pres);globalpos = pos(indx,:);minpres(1) = min(pres); % minimum pressure%-----------------------------------------------------------------% Rank the air parcels:[sorted_pres rank_ind] = sort(pres);% Sort the air parcels:pos = pos(rank_ind,:);keepglob(1) = globalpres;%-----------------------------------------------------------------% Start iterations :iter = 1; % iteration counterfor ij = 2:param.maxit, % Update the velocity: for i=1:param.popsize % choose random dimensions: a = randperm(param.npar); % choose velocity based on random dimension: velot(i,:) = vel(i,a); vel(i,:) = (1-param.alp)*vel(i,:)-(param.g*pos(i,:))+ ... abs(1-1/i)*((globalpos-pos(i,:)).*param.RT)+ ... (param.c*velot(i,:)/i); end % Check velocity: vel = min(vel, maxV); vel = max(vel, -maxV); % Update air parcel positions: pos = pos + vel; pos = min(pos, 1.0); pos = max(pos, -1.0); % Evaluate population: (Pressure) for K=1:param.popsize, x = (dimMax - dimMin) * ((pos(K,:)+1)./2) + dimMin; pres(K,:) = sum (x.^2); end %---------------------------------------------------- % Finding best particle in population [minpres,indx] = min(pres); minpos = pos(indx,:); % min location for this iteration %---------------------------------------------------- % Rank the air parcels: [sorted_pres rank_ind] = sort(pres); % Sort the air parcels position, velocity and pressure: pos = pos(rank_ind,:); vel = vel(rank_ind,:); pres = sorted_pres; % Updating the global best: better = minpres < globalpres; if better globalpres = minpres % initialize global minimum globalpos = minpos; end % Keep a record of the progress: keepglob(ij) = globalpres; save WDOposition.txt pos -ascii -tabs;end %Save values to the final file. pressure = transpose(keepglob); save WDOpressure.txt pressure -ascii -tabs; % Plot the pressure function progress over iterations: semilogy(keepglob, 'k' ,'LineWidth',2) title(['Global Best Pressure is " ',num2str(keepglob(1,param.maxit)),' ".']) xlabel('Number of Iterations') ylabel('Global Pressure (i.e. fitness) in log scale') grid on xlim([0, param.maxit]) %END%-----------------------------------------------------
3 仿真结果
4 参考文献
[1]马萌萌. 基于深度学习的极限学习机算法研究. Diss. 中国海洋大学, 2015.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~