Hope you are doing well,
time-series data preparation video tutorial part 1,
code and results output, part 2,
Monthly closing prices of S&P500
Monthly Australian Sales of Red Wine Jan1980Jul1995
yearly US accidents
Global Ice Volume
you can download the first version of the code from here(current page):
the second version of code(Future Forcast with MLP and LSTM) from here:
the third version of code(Future Forcast with MLP, LSTM, and CNN) from here:
and this is my website you can find useful information about the time series from there:
If you have questions or would like to improve the code, don't hesitate
to mail me: email@example.com
23 Nov 2018
05, Dec, 2020
Abolfazl Nejatian (2021). Time Series Prediction (https://www.mathworks.com/matlabcentral/fileexchange/69506-time-series-prediction), MATLAB Central File Exchange. Retrieved .
Dear Mr. Abolfazi, I have tried to execute your free version of the code, and it gives the error message "Reference to non-existent field 'BiLSTM'.
". You have done the great work on it, can you plz share the code with future prediction? I have sent you an email, plz check, thanks and best wishes
Dear Mr Abolfazl, the third code is very interesting (TimeSeriesPrediction_Forcasting_CNN_LSTM), I have executed it and I find it satisfactory.
However for the predictions it is also necessary to have the third code. Thank you and Best wishes Mr Abolfazl Nejatian
hi I think it is a well written code, have you performed forecasting of solar/wind energy ?
dear @Vitaly Kheyfets
Thank you for your helpful comment.
Now you can also see the prediction in the description section video.
and download it from my web site.
This is a very nicely written code, but I don't think this approach is correct for time series forecasting. I'm not sure a NN is doing much here. The code is basically just training an AR model, but AR models require that the time series is stationary. If, instead of evaluating model performance by regression, one constructs a confusion matrix to compare daily stock increase vs. decrease, the prediction accuracy is at around 50%.
excellent job. tks
I faced a problem
Reference to non-existent field 'XTs'.
I faced a problem
Reference to non-existent field 'XTs'.
Error in timeSeriesPrediction_1>evaluateNet (line 275)
TestOutputs = (predict(results.Net,data.XTs,'MiniBatchSize',opt.miniBatchSize));
Error in timeSeriesPrediction_1 (line 72)
results = evaluateNet(results,data,opt);
What about the forecasting data? where could i see those?
Same question as Ali, please include the xlsx sample data file. It's missing in the zip downlaod. Thanks!
The code is nice - as mentioned before the calculation of mean and std should be applied only to train data. It could also be improved by adding selectable multiple steps ahead predictions capability into general parameters section of the code.
Hi, I'm begginer in Matlab.
How I can use the code to forecast the future time series? I can read test data, but I want find 10-12 future series.
in 'results' variable I see only compare beetween targets and outputs for test data.
Hello, the following error occurred while I was running
The function or variable 'sequenceInputLayer' is not defined.
Error LSTMArchitect (line 14)
Error main4 (line 44)
Opt = LSTMArchitect(opt);
Hello, I feel the code needs to be
changed. It seems that it can read the test data and tune the model accordingly. It should not be in a practical case.
Abolfazl is a nice and helping person. He tries to help with the code.
Thank you for sharing the code, but i have a problem when trying to run it, i have this error massage :
Struct contents reference from a non-struct array object.
Error in timeSeriesPrediction (line 44)
could you help please.
thanks in advance
data file (.xlsx) ? Can anyone upload data file as a reference?
i discussed the code with other experts and I can confirm that Victor Plaza is right. The code assumes that the mean and deviation for test set is known, which is not possible and unsuitable for a real-time forecasting
I think your code is biased from the beginning. You are normalizing the data previously to split it into training and testing.
That implies you know the mean and the standard deviation of the testing set, what is false. You need to calculate these measures for the training set, what is what you will have in online processing, and later apply it to the testing set.
Calculating them over the whole data set allows the LSTM to access data that is actually unavailable.
Thank you for posting this code. I have a question regarding the possibility of multistep ahead predictions using this code.
I see that the delays can be used to train the LSTM on several step ahead data. The test set is also prepared in a similar manner. It seems that the predictions are N- step ahead where N would be max(Delays)+1. But when i observe the results in my case, it does not seem to be the case.
I would kindly request you to give an interpretation (with respect to prediction horizon) for the plot showing 'all data'.
I have a time series with of length 720 samples with 30 sec interval between two consecutive samples. I am basically trying to: (i) get predictions for one hour ahead (ii) given the time series, predict 'n' further steps of that series.
Thank you for your time!
dear @Eduardo Santos
by downloading the updated code, you can find output data on the workspace in 'results' variable.
How may I see the forecast data? I mean... How do interpret the script output data?
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!