How to implement Sliding window training with Neural Network Time Series Prediction? -


i have 2 datasets input , target containing hourly temperature data 1 year (8764 timesteps). tried multi-step ahead prediction using narxnet in matlab.i predicted temperature 24 steps ahead. trying implement sliding window training existing model.the below figure shows sliding window concept.

moving window training

below codes used multistep ahead prediction

filename_x = 'input.xlsx';       filename_y = 'target.xlsx';       x = transpose(xlsread(filename_x,1));       y = transpose(xlsread(filename_y,1));       x = con2seq(x);       t = con2seq(y);       %% 2. data preparation      n = 24;    % multi-step ahead prediction   % input , target series divided in 2 groups of data:   % 1st group: used train network inputseries  = x(1:end-n); targetseries = t(1:end-n); % 2nd group: new data used simulation. inputseriesval  % used predicting new targets. targetseriesval used % network validation after prediction inputseriesval  = x(end-n+1:end); targetseriesval = t(end-n+1:end); % not available %% 3. network architecture delay = 1; neuronshiddenlayer = 20; % network creation net = narxnet(1:delay,1:delay,neuronshiddenlayer); %% 4. training network [xs,xi,ai,ts] = preparets(net,inputseries,{},targetseries);  net = train(net,xs,ts,xi,ai); view(net) y = net(xs,xi,ai);  % performance series-parallel implementation,  % one-step-ahead prediction perf = perform(net,ts,y); %% 5. multi-step ahead prediction [xs1,xio,aio] = preparets(net,inputseries(1:end-delay),{},targetseries(1:end-delay)); [y1,xfo,afo] = net(xs1,xio,aio); [netc,xic,aic] = closeloop(net,xfo,afo); [ypred,xfc,afc] = netc(inputseriesval,xic,aic); multistepperformance = perform(net,ypred,targetseriesval); view(netc) figure; 


Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -