How to time series forecasting with the trained neural network?

2 ビュー (過去 30 日間)
Jan Kostrzewa
Jan Kostrzewa 2015 年 3 月 7 日
回答済み: Greg Heath 2015 年 3 月 10 日
Hello ! I would like to train neural network and then on that neural network do time series forecasting. In orderd to do so I use such rather typical code.
[x,xi,ai,t] = preparets(net,{},{},T);
net.divideFcn = 'dividerand'; % Divide data randomly
net.divideMode = 'time'; % Divide up every value
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
[net,tr] = train(net,x,t,xi,ai,'useParallel','yes');
y = net(x,xi,ai);
e = gsubtract(t,y);
mse = perform(net,t,y);
when I have trained naural net I would like to get new y(t+1) value
output = net(y(t)) //or any number
output = sim(net,[y(t-1) y(t-2)]) //or vector of any numbers
Unfortunately doesn't matter what is the value of y(t) I get always output = -1.8812.
Could anybody explain me what I do wrong? What i should do to be able to predict y(t+1) value.
Thank you very much for helping. Janek

採用された回答

Greg Heath
Greg Heath 2015 年 3 月 10 日
[ Y Xf Af ]= net( X, Xi, Ai ); % In the target region
for post target prediction
Xpi = Xf
Api = Af
[ Yp Xpf Apf ]= net( Xp, Xpi, Api );
Hope this helps
Thank you for formally accepting my answer
Greg

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSequence and Numeric Feature Data Workflows についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by