




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、新版Matlab中神經(jīng)網(wǎng)絡(luò)訓(xùn)練函數(shù)Newff的使用方法一、 介紹新版newffSyntax· net = newff(P,T,S1 S2.S(N-l),TF1 TF2.TFNl, BTF,BLF,PF,IPF,OPF,DDF)Descriptionnewff(P,T,S1 S2.S(N-l),TF1 TF2.TFNl, BTF,BLF,PF,IPF,OPF,DDF) takes several argumentsPR x Q1 matrix of Q1 sample R-element input vectorsTSN x Q2 matrix of Q2 sample SN-elem
2、ent target vectorsSiSize of ith layer, for N-1 layers, default = .(Output layer size SN is determined from T.)TFiTransfer function of ith layer. (Default = 'tansig' forhidden layers and 'purelin' for output layer.)BTFBackpropagation network training function (default = 'trainlm
3、39;)BLFBackpropagation weight/bias learning function (default = 'learngdm')IPFRow cell array of input processing functions. (Default = 'fixunknowns','removeconstantrows','mapminmax')OPFRow cell array of output processing functions. (Default = 'removeconstantrows
4、39;,'mapminmax')DDFData divison function (default = 'dividerand')ExamplesHere is a problem consisting of inputs P and targets T to be solved with a network.· P = 0 1 2 3 4 5 6 7 8 9 10;T = 0 1 2 3 4 3 2 1 2 3 4;Here a network is created with one hidden layer of five neurons.
5、3; net = newff(P,T,5);The network is simulated and its output plotted against the targets.· Y = sim(net,P);plot(P,T,P,Y,'o')The network is trained for 50 epochs. Again the network's output is plotted.· net.trainParam.epochs = 50;net = train(net,P,T);Y = sim(net,P);plot(P,T,P,Y,
6、'o')二、 新版newff與舊版newff調(diào)用語法對(duì)比Example1比如輸入input(6*1000),輸出output為(4*1000),那么舊版定義:net=newff(minmax(input),14,4,'tansig','purelin','trainlm');新版定義:net=newff(input,output,14,'tansig','purelin','trainlm');Example2比如輸入input(6*1000),輸出output為(4*1000),那
7、么舊版定義:net=newff(minmax(input),49,14,4,'tansig','tansig','tansig','traingdx');新版定義:net=newff(input,output, 49,14, 'tansig','tansig','tansig','traingdx');三、 舊版newff使用方法在新版本中使用提示:舊版本定義的newff雖也能在新版本中使用,但會(huì)有警告,警告如下:Warning: NEWFF used in an o
8、bsolete way. > In obs_use at 18 In newff>create_network at 127 In newff at 102 See help for NEWFF to update calls to the new argument list.四、 新版newff與舊版newff使用的訓(xùn)練效果對(duì)比舊版本:舊用法訓(xùn)練次數(shù)多,但精度高 新版本:新用法訓(xùn)練次數(shù)少,但精度可能達(dá)不到要求造成上述原因是:程序里面的權(quán)值、閾值的初始值是隨機(jī)賦
9、值的,所以每次運(yùn)行的結(jié)果都會(huì)不一樣,有好有壞。你可以把預(yù)測效果不錯(cuò)的網(wǎng)絡(luò)的權(quán)值和閾值作為初始值。具體可以查看net.iw1,1、net.lw2,1、net.b1、net.b2的值?,F(xiàn)在給一個(gè)完整的例子 % 清空環(huán)境變量clcclear% 訓(xùn)練數(shù)據(jù)預(yù)測數(shù)據(jù)data=importdata('test.txt');%從1到768間隨機(jī)排序k=rand(1,768);m,n=sort(k);%輸入輸出數(shù)據(jù)input=data(:,1:8);output =data(:,9);%隨機(jī)提取500個(gè)樣本為訓(xùn)練樣本,268個(gè)樣本為預(yù)測樣本input_train=input(n(1:500),:
10、)'output_train=output(n(1:500),:)'input_test=input(n(501:768),:)'output_test=output(n(501:768),:)'%輸入數(shù)據(jù)歸一化inputn,inputps=mapminmax(input_train);% BP網(wǎng)絡(luò)訓(xùn)練% %初始化網(wǎng)絡(luò)結(jié)構(gòu)net=newff(inputn,output_train,10);net.trainParam.epochs=1000;net.trainParam.lr=0.1;net.trainParam.goal=0.0000004;% 網(wǎng)絡(luò)訓(xùn)練net
11、=train(net,inputn,output_train);% BP網(wǎng)絡(luò)預(yù)測%預(yù)測數(shù)據(jù)歸一化inputn_test=mapminmax('apply',input_test,inputps);%網(wǎng)絡(luò)預(yù)測輸出BPoutput=sim(net,inputn_test);% 結(jié)果分析%根據(jù)網(wǎng)絡(luò)輸出找出數(shù)據(jù)屬于哪類BPoutput(find(BPoutput<0.5)=0;BPoutput(find(BPoutput>=0.5)=1;% 結(jié)果分析%畫出預(yù)測種類和實(shí)際種類的分類圖figure(1)plot(BPoutput,'og')hold onplot(output_test,'r*');legend('預(yù)測類別','輸出類別')title('BP網(wǎng)絡(luò)預(yù)測分類與實(shí)際類別比對(duì)','fontsize',12)ylabel('類別標(biāo)簽','fontsize',12)xlabel('樣本數(shù)目','fontsize',12)ylim(-0.5 1.5)%預(yù)測正確率rightnum
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年邯鄲貨運(yùn)資格證模擬考試題
- AI算法設(shè)計(jì)與應(yīng)用操作手冊
- 食品原料來源可追溯管理系統(tǒng)開發(fā)
- 品味古典詩詞韻味之美-高三古詩文誦讀與賞析教學(xué)教案
- 2025年新疆從業(yè)資格證500道題速記
- 江干區(qū)小學(xué)英語試卷
- 鎢基高比重合金競爭策略分析報(bào)告
- 小學(xué)英語買試卷
- 公司承包轉(zhuǎn)讓合同范本
- 雙方變更合同范本
- 全天麻膠囊咨詢報(bào)告范文
- 肝細(xì)胞癌轉(zhuǎn)化治療
- 廣東省佛山一中、石門中學(xué)2025屆高考語文考前最后一卷預(yù)測卷含解析
- 地質(zhì)災(zāi)害預(yù)防培訓(xùn)課件
- 2025新譯林版英語七年級(jí)下單詞默寫表
- 部編版小學(xué)語文三年級(jí)下冊第六單元教材解讀及教學(xué)建議
- DB11T 1315-2015 綠色建筑工程驗(yàn)收規(guī)范
- 《ISO 41001-2018 設(shè)施管理- 管理體系 要求及使用指南》專業(yè)解讀與應(yīng)用指導(dǎo)材料之16:“8運(yùn)行”(雷澤佳編制-2024)
- 2024智慧城市數(shù)據(jù)分類標(biāo)準(zhǔn)規(guī)范
- Linux系統(tǒng)管理與服務(wù)器配置-基于CentOS 7(第2版) 課件 第1章CentOS Linux 7系統(tǒng)的安裝與介紹
- 新目標(biāo)英語中考一輪教材梳理復(fù)習(xí)教案
評(píng)論
0/150
提交評(píng)論