Variable delays in NARX net

2 次查看(过去 30 天)
mathbourne
mathbourne 2016-7-15
评论: Greg Heath 2016-7-16
Using the Neural Network Toolbox, I would like to forecast the hourly sales from a shop for a year. The shop itself only gives the sales data 18 hours after it happened.
Another shop of the same type also gives the data 18 hours after it happened but in the meantime, they give a forecast. Since the sales between the two are correlated, I wanna use the sales from the other shop as an external input in a NARXNET.
To train my net, I have the choice of using the real sales of the other shop; b_sales, or the forecast; b_sales_forecast.
What I would really like to do however is use all the information.
At each timestep, I would like to have a compound of the 2 variables; input delays from 0 to 18 would be b_sales_forecast and from 19 to 48 would be b_sales.
I thought I would find a way to do this within the 'tonndata' or the 'preparets' function but I found nothing.
This is my code :
dataset = [dummyvar(date_string.Month) dummyvar(date_string.Hour+1) b_sales_forecast];
X = tonndata(dataset,false,false);
T = tonndata(a_sales,false,false);
trainFcn = 'trainlm';
inputDelays = 0:48;
feedbackDelays = 18:48;
hiddenLayerSize = 25;
net1 = narxnet(inputDelays,feedbackDelays,hiddenLayerSize,'open',trainFcn);
[x,xi,ai,t] = preparets(net1,X,{},T);
net1.divideParam.trainRatio = 70/100;
net1.divideParam.valRatio = 15/100;
net1.divideParam.testRatio = 15/100;
[net1,tr] = train(net1,x,t,xi,ai);
y = net1(x,xi,ai);
output=cell2mat(y)';
Thank you for your time.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Sequence 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