



下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、利用MATLAB中g(shù)atool快速實現(xiàn)訓(xùn)練神經(jīng)網(wǎng)絡(luò)的遺傳算法程序Deng Da-PengGenetic Algorithm,as an famous intelligent algorithm based on evolutionary thoughts, has been widely used to weights training and parameters optimization of neural networks. Essentially, GA is a global stochastic searching algorithm, which approximating gl
2、obal minima through Selection、Crossover and Mutation operators. It is difficult for many researchers to utilize advanced programming languages to implement GA. Actually, MATLAB provide us a very good graphic user interface of GA, named gatool, in GADS toolbox.Below contents illustrate how to use thi
3、s GUI tool to implement combination of GA and NN. In this case, I construct a feed forward network, which topological structure is 5-3-1, transfer functions are tansig and purelin for hidden and output layer, respectively. The key step is write a function to calculate fitness of chromosomes in GA po
4、pulation. Below code is implement this fitness calculating function in this case.function netout = netcal(pm) iN=5; hN=3;oN=1; % add your training sets here P= ; T= ; % Pre-processing data sets Pn,minP,maxP,Tn,minT,maxT = premnmx(P,T); net=newff(minmax(Pn),hN,oN,'tansig','purelin');
5、x,y=size(pm); for j=1:hN x2iw(j,:)=pm(1,(j-1)*iN+1):j*iN); end for k=1:oN x2lw(k,:)=pm(1,(iN*hN+1):(iN*hN+hN); end x2b=pm(1,(iN+1)*hN+1):y); x2b1=x2b(1:hN).' x2b2=x2b(hN+1:hN+oN).' net.IW1,1=x2iw; net.LW2,1=x2lw; net.b1=x2b1; net.b2=x2b2; netout=mse(sim(net,Pn)-Tn); % this error function pro
6、vides fitness for chromosomeOK, save this function with a name, i.e., netcal.m. Then, let's start gatool in MATLAB command line. The GUI of gatool is below.click then launchparameters settingclick and see helpenter num of weightsenter fitness functionFill name of fitness calculating function in
7、fitness function textbox, but note that add '' before function name. Calculate numbers of weights of network, in this case is 22. Then, you need set parameters of GA in right. This step need you understand GA. If any question, you can see help.Complete all these steps, click start button and
8、 launch training. When training process is end ,you will see a best chromosome in lower corner of left. This final result is best weight array of NN trained by GA. Change it to weight matrix and transfer to network according to fitness function code, then simulation with working sets and observe net
9、work performance.You can generate a m files through "generate M-file" in "file" menu. In this case, the M-file code is showed below. You may add some code in the end of this function for convenience.OK, it is end. Thanks for your reading and hope for your reviews and comments.bes
10、t chromosomefunction X,FVAL,REASON,OUTPUT,POPULATION,SCORES = untitled% This is an auto generated M file to do optimization with the Genetic Algorithm and% Direct Search Toolbox. Use GAOPTIMSET for default GA options structure. %Fitness functionfitnessFunction = netcal;%Number of Variablesnvars = 22
11、;%Start with default optionsoptions = gaoptimset;%Modify some parametersoptions = gaoptimset(options,'PopInitRange' ,-0.5 ; 0.5 );options = gaoptimset(options,'StallGenLimit' ,100);options = gaoptimset(options,'CrossoverFcn' , crossoverheuristic 1.2 );options = gaoptimset(options,'MutationFcn' , mutationgaussian 1 1 );options = gaoptimset(options,'Display' ,'of
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 陽光學(xué)院《流體傳動與控制基礎(chǔ)》2023-2024學(xué)年第二學(xué)期期末試卷
- 武漢海事職業(yè)學(xué)院《單片機(jī)原理與應(yīng)用綜合設(shè)計》2023-2024學(xué)年第二學(xué)期期末試卷
- 大興安嶺職業(yè)學(xué)院《企業(yè)電子產(chǎn)品設(shè)計與制造》2023-2024學(xué)年第二學(xué)期期末試卷
- 四川汽車職業(yè)技術(shù)學(xué)院《科學(xué)社會主義概論》2023-2024學(xué)年第二學(xué)期期末試卷
- 雙頭應(yīng)急燈項目效益評估報告
- 沈陽音樂學(xué)院《內(nèi)科護(hù)理學(xué)(2)》2023-2024學(xué)年第二學(xué)期期末試卷
- 鄭州商貿(mào)旅游職業(yè)學(xué)院《社會治理》2023-2024學(xué)年第二學(xué)期期末試卷
- 伊犁師范大學(xué)《中職英語微格教學(xué)技能訓(xùn)練》2023-2024學(xué)年第二學(xué)期期末試卷
- 人教版初中歷史與社會七年級上冊 3.5 干旱的寶地-塔里木盆地 教學(xué)設(shè)計
- 七年級人教版上冊教學(xué)設(shè)計第四單元第四課 汽車城蔚山教學(xué)設(shè)計
- 醫(yī)院骨科專病數(shù)據(jù)庫建設(shè)需求
- 三年級下冊混合計算100題及答案
- 中小學(xué)幼兒園安全風(fēng)險防控工作規(guī)范
- ESD技術(shù)要求和測試方法
- 正確認(rèn)識民族與宗教的關(guān)系堅持教育與宗教相分離
- 宜黃縣二都鎮(zhèn)高山飾面用花崗巖開采以及深加工項目環(huán)評報告
- 血液科護(hù)士的惡性腫瘤護(hù)理
- 畜禽廢棄物資源化利用講稿課件
- 土地糾紛調(diào)解簡單協(xié)議書
- 服裝倉庫管理制度及流程
- 《餐飲渠道開發(fā)方案》課件
評論
0/150
提交評論