Can Greg post an example for using neural network time series in the whole sense?
4 views (last 30 days)
Show older comments
Shashank Bhatia
on 7 Aug 2018
Edited: Walter Roberson
on 13 Sep 2020
I am using neural network time series to predict stock price for next week. Normal procedure to approach this problem as explained in nnhelp isn't sufficient. Errors are big and results are absurd. Going through online help, I have seen various answers by Greg which are somewhat helpful but really time consuming. If Greg can write the process for X = phInputs;T = phTargets; example it would be really enlightening. citing steps for 1. Normalize the data (making a time-series stationary), 2. Choosing hidden layer number, 3. Feedback delay number, 4. Data classification (using datablock)
4 Comments
Accepted Answer
Greg Heath
on 7 Aug 2018
Can Greg post an example for using neural network time series in the whole sense?
Yes he can … and in fact, he has! If the examples are not in ANSWERS, then they must be in COMP.SOFT-SYS.MATLAB!
It may sound strange, but I would first search using the terms
greg ph
If still bewildered, I'm sure you can find similar posts using other MATLAB time-series sample data.
help nndatssets
doc nndatasets
Thank you for formally accepting my answer
Greg
4 Comments
Greg Heath
on 7 Aug 2018
As you know, I have posted hundreds of NN posts over the years in this and other groups. At this point I have no idea where particular posts are. Also, it is rare that only one of the posts is relevant to a particular question. All I can do is suggest reasonable search words.
The reference nndatasets is where the MATLAB sample data is. It makes no sense for me to spend my time on other data.
Typically, there is more than one relevant reference. I'll check that reference and get back to you.
More Answers (3)
Greg Heath
on 9 Aug 2018
Edited: Greg Heath
on 9 Aug 2018
Q1a: Do I need to normalize/standardize the data before feeding to neural network?
A1a: Typically, Yes. One of the following
Normalization : range = [ 0,1 ]
Standardization: [mean, variance] = [ 0,1 ]
Q1b: Or does neural network take care for standardization of data
A1b: MATLAB automatically normalizes
I prefer to standardize
Q2: How can I decide range of the data to be used? 5 yrs or 10 years? Is the process of doing so manual observing model mse?
A2: Always plot the data before making any decisions.
Then decide what model(s) might be appropriate.
You may have to use different models in different
ranges.
Q3: How can I decide number of hidden layers, FD (feedback delays)? Is the process manual?
A3a: One hidden layer is always sufficient.
Specific knowledge of the data may warrant
two. I determine number of hidden nodes by
trial and error.
A3b. I determine characteristic delays from the
auto and crosscorrelation functions
Q4: After making the network with sufficiently accurate mse, do I need to convert the net into closed-loop (netc) for next week prediction?
A4. It depends on which time-series model that you are using.
If it is a feedback model it should be obvious that you need to
close the loop to predict the future.
A4: Yes. I have posted more than a sufficient number
of tutorials in the NEWSGROUP and ANSWERS.
Hope this helps.
*Thank you for formally accepting my answer*
Greg
0 Comments
Greg Heath
on 9 Aug 2018
Q1a: Do I need to normalize/standardize the data before feeding to neural network?
A1a: Typically, Yes. One of the following
Normalization : range = [ 0,1 ]
Standardization: [mean, variance] = [ 0,1 ]
Q1b: Or does neural network take care for standardization of data
A1b: MATLAB automatically normalizes
I prefer to standardize
Q2: How can I decide range of the data to be used? 5 yrs or 10 years? Is the process of doing so manual observing model mse?
A2: Always plot the data before making any decisions.
Then decide what model(s) might be appropriate.
You may have to use different models in different
ranges.
Q3: How can I decide number of hidden layers, FD (feedback delays)? Is the process manual?
A3a: One hidden layer is always sufficient. Specific
knowledge of the data may warrant two. I determine
number of hidden nodes by trial and error.
A3b. I determine characteristic delays from the auto
and crosscorrelation functions
Q4: After making the network with sufficiently accurate mse, do I need to convert the net into closed-loop (netc) for next week prediction?
A4: Yes. I have posted more than a sufficient number
of tutorials in the NEWSGROUP and ANSWERS.
Hope this helps.
*Thank you for formally accepting my answer*
Greg
1 Comment
Shashank Bhatia
on 8 Aug 2018
3 Comments
Greg Heath
on 12 Aug 2018
The only thing different about your case is the dominant low order (quadratic, cubic,...?) polynomial trend.
Subtracting that out should yield a decent long term predictor.
Then you can use the remainder for short term predictions.
Greg
See Also
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!