如何从训练好的NARX神经网络中进行预测?

24次浏览(过去30天)
Lavnish古普塔
Lavnish古普塔 2020年8月16日
编辑: georg enyew2021年2月5日
我从一篇研究论文中获得了以下代码,该论文实现了一个使用外源输入训练网络的NARX神经网络:
% Anp -输入时间序列。
% Adtds -反馈时间序列。
X = tonndata(Anp,true,false);
T = tonndata(Adtds,true,false);
选择'trainlm'训练函数
trainFcn =“trainlm”% Levenberg-Marquardt反向传播。
%模型创建
inputdelayed = 1:2;
feedbackdelayed = 1:2;
hiddenLayerSize = 10;
net = narxnet(inputdelayed, feedbackdelayed,hiddenLayerSize,“开放”, trainFcn);
%训练及模拟数据准备
[x,xi,ai,t] = preparets(net, x, {}, t);
为训练、验证和测试划分数据。
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 0/100;
net.divideParam.testRatio = 30/100;
网divideFcn =“divideblock”
网络培训
[net,tr] = train(net,x,t,xi,ai);
%网络测试
Y = net(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 = cloloop (net);
net.name = [net.name .“-闭环”];
视图(netc)
[xc,xic,aic,tc] = preparets(netc,X,{},T);
Yc = netc(xc,xic,aic);
closedLoopPerformance = execute (net,tc,yc)
步进预测网络
net = removedelay(net);
net.name = [net.name .“提前预测一步”];
视图(网)
[xs,xis,ais,ts] = preparets(nets,X,{},T);
Ys = nets(xs,xis,ais);
steppaheadperformance =执行(nets,ts,ys)
我能理解它是在训练网络。但我无法理解如何预测网络从未见过的新输入数据的输出。我尝试使用net(input_Series),但它给了我输入不充分的错误。有人能帮帮我吗?

答案(1)

格雷格·希斯
格雷格·希斯 2020年8月17日
你忘记了初始条件:
Yz = nets(xz,xiz,aiz);
感谢您正式接受我的答复
格雷格
2的评论
georg enyew
georg enyew 2021年2月5日
编辑:georg enyew 2021年2月5日
这个问题发生在我身上吗?怎么会这样呢?任何帮助我们的人我都很感激。

登录评论。

社区寻宝

在MATLAB Central中找到宝藏,并发现社区如何帮助您!

开始狩猎!