【BP預(yù)測(cè)】基于Tent混沌映射原子搜索算法優(yōu)化BP神經(jīng)網(wǎng)絡(luò)實(shí)現(xiàn)數(shù)據(jù)回歸預(yù)測(cè)附matlab代碼
1 簡介
BP神經(jīng)網(wǎng)絡(luò)算法使用非常廣泛,傳統(tǒng)的BP神經(jīng)網(wǎng)絡(luò)算法雖然具有不錯(cuò)的擬合非線性函數(shù)的能力,但是容易陷入局部的極小值,并且傳統(tǒng)的算法收斂的速度慢.本篇文章詳細(xì)地論述了如何使用ent混沌映射原子搜索算法算法優(yōu)化傳統(tǒng)的BP神經(jīng)網(wǎng)絡(luò)算法中初始的權(quán)值和閥值,通過相應(yīng)的驗(yàn)證和比較提出了該模型的有效性.
作為物理-元啟發(fā)式算法中的一種,ASO 最早在 2018 年由趙衛(wèi)國提出并將其應(yīng)用于地下水分散系數(shù)估計(jì)。ASO 的靈感來自于基本的分子動(dòng)力學(xué),自然界中所有的物質(zhì)都是由原子組成,原子具備質(zhì)量和體積,在一個(gè)原子系統(tǒng)中,所有原子都是相互作用并且處于恒定的運(yùn)動(dòng)狀態(tài),其微觀相互作用十分復(fù)雜。隨著科學(xué)技術(shù)的發(fā)展,近些年來分子動(dòng)力學(xué)發(fā)展迅速,已經(jīng)可以使用計(jì)算機(jī)模擬原子和分子的物理運(yùn)動(dòng)規(guī)律。




2 部分代碼
%--------------------------------------------------------------------------
% GSA code v1.0.
% Developed in MATLAB R2011b
% The code is based on the following papers.
% W. Zhao, L. Wang and Z. Zhang, Atom search optimization and its
% application to solve a hydrogeologic parameter estimation problem,
% Knowledge-Based Systems (2018), https://doi.org/10.1016/j.knosys.2018.08.030.
%
% W. Zhao, L. Wang and Z. Zhang, A novel atom search optimization for
% dispersion coefficient estimation in groundwater, Future Generation
% Computer Systems (2018), https://doi.org/10.1016/j.future.2018.05.037.
%--------------------------------------------------------------------------
% Atom Search Optimization.
function [X_Best,Fit_XBest,Functon_Best]=ASO(alpha,beta,Fun_Index,Atom_Num,Max_Iteration)
% Dim: Dimension of search space.
% Atom_Pop: Population (position) of atoms.
% Atom_V: ?Velocity of atoms.
% Acc: Acceleration of atoms.
% M: Mass of atoms.
% Atom_Num: Number of atom population.
% Fitness: Fitness of atoms.
% Max_Iteration: Maximum of iterations.
% X_Best: Best solution (position) found so far.
% Fit_XBest: Best result corresponding to X_Best.
% Functon_Best: The fitness over iterations.
% Low: The low bound of search space.
% Up: The up bound of search space.
% alpha: Depth weight.
% beta: Multiplier weight
alpha=50;
beta=0.2;
? Iteration=1;
? [Low,Up,Dim]=Test_Functions_Range(Fun_Index);
? % Randomly initialize positions and velocities of atoms.
? ? if size(Up,2)==1
? ? ? ? Atom_Pop=rand(Atom_Num,Dim).*(Up-Low)+Low;
? ? ? ? Atom_V=rand(Atom_Num,Dim).*(Up-Low)+Low;
? ? end
? ? if size(Up,2)>1
? ? ? ?for i=1:Dim
? ? ? ? ? Atom_Pop(:,i)=rand(Atom_Num,1).*(Up(i)-Low(i))+Low(i);
? ? ? ? ? Atom_V(:,i)=rand(Atom_Num,1).*(Up(i)-Low(i))+Low(i);
? ? ? ?end
? ? end
% Compute function fitness of atoms.
? ? for i=1:Atom_Num
? ? ? Fitness(i)=Test_Functions(Atom_Pop(i,:),Fun_Index,Dim);
? ? end
? ? ? Functon_Best=zeros(Max_Iteration,1);
? ? ? [Max_Fitness,Index]=min(Fitness);
? ? ? Functon_Best(1)=Fitness(Index);
? ? ? X_Best=Atom_Pop(Index,:);
% Calculate acceleration.
Atom_Acc=Acceleration(Atom_Pop,Fitness,Iteration,Max_Iteration,Dim,Atom_Num,X_Best,alpha,beta);
% Iteration
for Iteration=2:Max_Iteration
? ? ? ? ? Functon_Best(Iteration)=Functon_Best(Iteration-1);
? ? ? ? ? Atom_V=rand(Atom_Num,Dim).*Atom_V+Atom_Acc;
? ? ? ? ? Atom_Pop=Atom_Pop+Atom_V; ? ?
? ? ? ? for i=1:Atom_Num
? ? ? % Relocate atom out of range. ?
? ? ? ? ? TU= Atom_Pop(i,:)>Up;
? ? ? ? ? TL= Atom_Pop(i,:)<Low;
? ? ? ? ? Atom_Pop(i,:)=(Atom_Pop(i,:).*(~(TU+TL)))+((rand(1,Dim).*(Up-Low)+Low).*(TU+TL));
? ? ? ? ? %evaluate atom.
? ? ? ? ? Fitness(i)=Test_Functions(Atom_Pop(i,:),Fun_Index,Dim);
? ? ? ? end
? ? ? ?[Max_Fitness,Index]=min(Fitness); ? ? ?
? ? ? ?if Max_Fitness<Functon_Best(Iteration)
? ? ? ? ? ? Functon_Best(Iteration)=Max_Fitness;
? ? ? ? ? ? X_Best=Atom_Pop(Index,:);
? ? ? ? ?else
? ? ? ? ? ?r=fix(rand*Atom_Num)+1;
? ? ? ? ? ? Atom_Pop(r,:)=X_Best;
? ? ? ?end
? ? ?% Calculate acceleration.
? ? ? Atom_Acc=Acceleration(Atom_Pop,Fitness,Iteration,Max_Iteration,Dim,Atom_Num,X_Best,alpha,beta);
end
Fit_XBest=Functon_Best(Iteration);
3 仿真結(jié)果


4 參考文獻(xiàn)
[1]馬俊濤. 基于MATLAB的BP神經(jīng)網(wǎng)絡(luò)模型的預(yù)測(cè)算法研究[C]// 軍事信息軟件與仿真學(xué)術(shù)研討會(huì). 中國電子學(xué)會(huì), 2006.
博主簡介:擅長智能優(yōu)化算法、神經(jīng)網(wǎng)絡(luò)預(yù)測(cè)、信號(hào)處理、元胞自動(dòng)機(jī)、圖像處理、路徑規(guī)劃、無人機(jī)等多種領(lǐng)域的Matlab仿真,相關(guān)matlab代碼問題可私信交流。
部分理論引用網(wǎng)絡(luò)文獻(xiàn),若有侵權(quán)聯(lián)系博主刪除。
