-
大小: 3KB文件類型: .m金幣: 1下載: 0 次發(fā)布日期: 2021-05-13
- 語言: Matlab
- 標(biāo)簽: 神經(jīng)網(wǎng)絡(luò)??
資源簡介
narx動態(tài)神經(jīng)網(wǎng)絡(luò),動態(tài)神經(jīng)網(wǎng)絡(luò)預(yù)測重慶市用水量matlab代碼
代碼片段和文件信息
%?Solve?an?Autoregression?Problem?with?External?Input?with?a?NARX?Neural?Network
%?script?generated?by?Neural?Time?Series?app
%?Created?20-Sep-2018?21:10:56
%
%?This?script?assumes?these?variables?are?defined:
%
%???input1?-?input?time?series.
%???output?-?feedback?time?series.
X?=?tonndata(input1falsefalse);
T?=?tonndata(outputfalsefalse);
%?Choose?a?Training?Function
%?For?a?list?of?all?training?functions?type:?help?nntrain
%?‘trainlm‘?is?usually?fastest.
%?‘trainbr‘?takes?longer?but?may?be?better?for?challenging?problems.
%?‘trainscg‘?uses?less?memory.?Suitable?in?low?memory?situations.
trainFcn?=?‘trainlm‘;??%?Levenberg-Marquardt?backpropagation.
%?Create?a?Nonlinear?Autoregressive?Network?with?External?Input
inputDelays?=?1:12;
feedbackDelays?=?1:12;
hiddenlayerSize?=?9;
net?=?narxnet(inputDelaysfeedbackDelayshiddenlayerSize‘open‘trainFcn);
%?Prepare?the?Data?for?Training?and?Simulation
%?The?function?PREPARETS?prepares?timeseries?data?for?a?particular?network
%?shifting?time?by?the?minimum?amount?to?fill?input?states?and?layer
%?states.?Using?PREPARETS?allows?you?to?keep?your?original?time?series?data
%?unchanged?while?easily?customizing?it?for?networks?with?differing
%?numbers?of?delays?with?open?loop?or?closed?loop?feedback?modes.
[xxiait]?=?preparets(netX{}T);
%?Setup?Division?of?Data?for?Training?Validation?Testing
net.divideParam.trainRatio?=?75/100;
net.divideParam.valRatio?=?20/100;
net.divideParam.testRatio?=?5/100;
%?Train?the?Network
[nettr]?=?train(netxtxiai);
%?Test?the?Network
y?=?net(xxiai);
e?=?gsubtract(ty);
performance?=?perform(netty);
rmse=sqrt(performance);
%?View?the?Ne
評論
共有 條評論