After training my Neural Network, how do I use it?

1 view (last 30 days)
Hello
I used the Time Series Tool to generate a Script. I've placed as the input a 365x24 matrix (energy demand each hour for each day) and as the Target the same matrix but one-day forward.
My intention is that once the program is finished, I would place a 1x24 vector of the hourly demand energy and the program would give me its prediction 24 hours ahead (this means a 1x24 vector solution).
However, I was not able to figure out how can I use the script once the network has been trained.
Any help would be highly appreciated

Accepted Answer

Greg Heath
Greg Heath on 28 Aug 2014
The first thing you need to do is determine the significant lags of the autocorrelation function obtained from the training fraction (default is 0.7) of the 1x8760 hourly data.
Since you only have one series, the appropriate timeseries function is narnet. Use datadivisionFcn 'divideblock' instead of the silly 'dividerand' default.
Next determine how many hours ahead you want to predict at once. You seem to be thinking of a 24-dimensional input predicting a 24 dimensional output with a one hour sliding window. However, there are other lower dimensional possibilities that will be indicated by the significant lags determined above.
Use the form
[ net tr Ys Es Xf Af]= train(net,Xs,Ts,Xi,Ai);
So that predictions beyond your current data can be initialized with Xf and Af and continued in the closeloop mode.
You can search for some of my examples in the NEWSGROUP and ANSWERS using the search words
greg narnet closeloop
Hope this helps.
Thank you for formally accepting my answer
Greg
  2 Comments
Juan
Juan on 28 Aug 2014
But I do not wish to keep training the network. It's already been trained and it gave excellent results. The thing is that I want to start using it to make a prediction. The program creates three networks: "net", "netc" and "nets". I believe the one I need is the "nets" because it creates a target for y(t+1).
First, I create a 1x24 vector for the input. Then I change using
tonndata(vector,false,false)
Then I prepare the parameters using "preparets(nets,(),(),targetseries)"
But when I ask for the output with
ys = nets(xs,xis,ais)
An error comes up saying something about the matrix dimension has been exceeded.
Greg Heath
Greg Heath on 30 Aug 2014
Single inputs (24x1) and outputs (24x1) are column vectors, not row vectors.
Do not use the dividerand default that destroys correlations.

Sign in to comment.

More Answers (0)

Categories

Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!