91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 27KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-05-16
  • 語言: 其他
  • 標(biāo)簽: 代碼??

資源簡介

BP神經(jīng)網(wǎng)絡(luò)源代碼,壓縮包里面包括訓(xùn)練代碼、測試代碼、采樣數(shù)據(jù)。

資源截圖

代碼片段和文件信息

close?all?
clear?all?
clc?
web?-browser?http://www.ilovematlab.cn/thread-220251-1-1.html
x=xlsread(‘training_data.xls‘[‘B2:G401‘]);?
y=xlsread(‘training_data.xls‘[‘I2:K401‘]);?
inputs?=?x‘;?
targets?=?y‘;

%?創(chuàng)建一個模式識別網(wǎng)絡(luò)(兩層BP網(wǎng)絡(luò)),同時給出中間層神經(jīng)元的個數(shù),這里使用20
hiddenlayerSize?=?20;
net?=?patternnet(hiddenlayerSize);

%?對數(shù)據(jù)進行預(yù)處理,這里使用了歸一化函數(shù)(一般不用修改)
%?For?a?list?of?all?processing?functions?type:?help?nnprocess
net.inputs{1}.processFcns?=?{‘removeconstantrows‘‘mapminmax‘};
net.outputs{2}.processFcns?=?{‘removeconstantrows‘‘mapminmax‘};


%?把訓(xùn)練數(shù)據(jù)分成三部分,訓(xùn)練網(wǎng)絡(luò)、驗證網(wǎng)絡(luò)、測試網(wǎng)絡(luò)
%?For?a?list?of?all?data?division?functions?type:?help?nndivide
net.divideFcn?=?‘dividerand‘;??%?Divide?data?randomly
net.divideMode?=?‘sample‘;??%?Divide?up?every?sample
net.divideParam.trainRatio?=?70/100;
net.divideParam.valRatio?=?15/100;
net.divideParam.testRatio?=?15/100;

%?訓(xùn)練函數(shù)
%?For?a?list?of?all?training?functions?type:?help?nntrain
net.trainFcn?=?‘trainlm‘;??%?Levenberg-Marquardt

%?使用均方誤差來評估網(wǎng)絡(luò)
%?For?a?list?of?all?performance?functions?type:?help?nnperformance
net.performFcn?=?‘mse‘;??%?Mean?squared?error

%?畫圖函數(shù)
%?For?a?list?of?all?plot?functions?type:?help?nnplot
net.plotFcns?=?{‘plotperform‘‘plottrainstate‘‘ploterrhist‘?...
??‘plotregression‘?‘plotfit‘};


%?開始訓(xùn)練網(wǎng)絡(luò)(包含了訓(xùn)練和驗證的過程)
[nettr]?=?train(netinputstargets);

%?測試網(wǎng)絡(luò)
outputs?=?net(inputs);
errors?=?gsubtract(targetsoutputs);
performance?=?perform(nettargetsoutputs)

%?獲得訓(xùn)練、驗證和測試的結(jié)果
trainTargets?=?targets?.*?tr.trainMask{1};
valTargets?=?targets??.*?tr.valMask{1};
testTargets?=?targets??.*?tr.testMask{1};
trainPerformance?=?perform(nettrainTargetsoutputs)
valPerformance?=?perform(netvalTargetsoutputs)
testPerformance?=?perform(nettestTargetsoutputs)

%?可以查看網(wǎng)絡(luò)的各個參數(shù)
view(net)

%?根據(jù)畫圖的結(jié)果,決定是否滿意
%?Uncomment?these?lines?to?enable?various?plots.
figure?plotperform(tr)
figure?plottrainstate(tr)
figure?plotconfusion(targetsoutputs)
figure?ploterrhist(errors)


%如果你對該次訓(xùn)練滿意,可以保存訓(xùn)練好網(wǎng)絡(luò)
save(‘training_net.mat‘‘net‘‘tr‘);


?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2013-03-22?20:35??BP\
?????文件???????30369??2013-03-22?19:14??BP\training_data.xls
?????文件????????2238??2013-03-22?19:09??BP\Training_NPR.m
?????文件?????????600??2013-03-22?19:10??BP\Use_For_Predict.m

評論

共有 條評論