如何利用经过训练的NARX神经网络进行预测?
11次观看(过去30天)
显示旧的评论
我从一篇研究论文中得到了以下代码,它实现了一个NARX神经网络,使用一个外生输入训练网络:
% Anp -输入时间序列。
% Adtds -反馈时间序列。
X = tonndata (Anp,真、假);
T = tonndata (Adtds,真、假);
选择'trainlm'训练函数
trainFcn =“trainlm”;% Levenberg-Marquardt反向传播。
%模型创建
inputDelays = 1:2;
feedbackDelays = 1:2;
hiddenLayerSize = 10;
网= narxnet (inputDelays feedbackDelays hiddenLayerSize,“开放”, trainFcn);
培训和仿真数据准备。
[x, xi,人工智能,t] = preparets(净,x, {}, t);
将数据进行培训、验证和测试。
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 0/100;
net.divideParam.testRatio = 30/100;
网divideFcn =“divideblock”;
%网络培训
(净,tr) =火车(净,x, t, xi, ai);
%网络测试
净(y = x, xi, ai);
e = gsubtract (t、y);
性能=执行(净、t、y)
%网络视图
视图(净)
%的情节
图中,plotperform (tr)
图中,plottrainstate (tr)
图中,ploterrhist (e)
图,plotregression (t, y)
图,plotresponse (t, y)
图中,ploterrcorr (e)
图中,plotinerrcorr (x, e)
%闭环网络
netc = closeloop(净);
netc.name = [net.name“-闭环”];
视图(netc)
(xc、xic aic, tc) = preparets (netc, X, {}, T);
yc = netc (xc、xic aic);
closedLoopPerformance =执行(净、tc、yc)
步进预测网络
网= removedelay(净);
nets.name = [net.name“-提前一步预测”];
视图(网)
[X,切除酶,ais, ts) = preparets(网,X, {}, T);
y =网(xs,切除酶,ais);
stepAheadPerformance =执行(网、t、y)
我能理解它是在训练网络。但我无法理解如何预测网络从未见过的新输入数据的输出。我尝试使用net(input_Series),但它给我输入不充分的错误。有人能帮帮我吗?