How to Predict Timeseries data using Neural Network in Matlab

15 ビュー (過去 30 日間)
Muhammad Usman Saleem
Muhammad Usman Saleem 2022 年 5 月 28 日
編集済み: Muhammad Usman Saleem 2023 年 2 月 18 日
I've timeseries (past 31 years ) dataset of 41 independent variables. I want to predict my three dependent variables (These depends on rest 41 variables) using Neural Network in Matlab. I want to trained my ANN model using 80% timeseries dataset and 20% dataset for testing model. Then I want to predict (or forecaste) for two years (NAN values in excel file) my 3 dependent variables using my best trained model. I google about the problem, but not able to understand provided codes as mostly practice on images not excel dataset. How can I do that In Matlab?
I've attached my sample dataset which describe my problem well in excel with this question. A timely reply will be highly appriciated.

回答 (1 件)

Muhammad Usman Saleem
Muhammad Usman Saleem 2022 年 5 月 28 日
編集済み: Muhammad Usman Saleem 2023 年 2 月 18 日
Problems in the above code:
(1) I want to predict my first three columns which depends on 41 rest of colums? I want to predicted them one by one actual vs predicted in plots. I not sure whether the above code is doing the same or not??
(2) Just after the training in above code, why this mean, stdv has been caculate for all training data and testing data? Training and testing dataset consist on my 41 independent variables. Each variable has different sense that why mean or stdv looking not sense to this code? Is mean and stdv for single variable will be suitable in ANN? (according to understanding)?
(3) This is my step by step working: I want to make 90% training and 10% testing, then want to train the ANN. Then validate and select best neural network. Then want to predict 2 last values of first 3 columns in data.csv file from optimum ANN?
(4) At the end, I want to make sure from experts over this plate form which verify my code whether its doing the following tasks correctly or not ??
(5) Is after training the dataset for 45 variables, I can predict 1 variables out of 3? then variable no 2 and 3 ? Is the results get from the train model will be reliable for predicting individual variable? It's much confusing to me? Please clerify ? Please
I'll be very thankful to experts for timely response?
  2 件のコメント
Ieuan Evans
Ieuan Evans 2022 年 6 月 21 日
Hi Muhammad,
Thanks for the message. This is an interesting task!
Forecasting is not the correct approach for this task. Forecasting is best suited for scenarios where you have an incomplete time series, and you want to predict the next values of the sequence. For example, you have measure that correspond to time steps 1,2,...,T and you want to predict the same measurement for times T+1,T+2,...
It seems that you want to instead do something like predicting values [y1, y2, y3] given a sequence [x_Nov, ..., x_Apr], where x_i are vectors of size 7. You should be able to use sequence-to-one regression for this. That is, given a sequence, predict a single vector.
This example may help better: https://www.mathworks.com/help/deeplearning/ug/sequence-to-one-regression-using-deep-learning.html This example takes a sequence as input and predict a single *value*. You can adapt this example such that it outputs a single vector instead of a single number.
The strategy would be to formulate your training data such that XTrain is a cell array of 31 sequences, that correspond to each year 1991-2020. Each sequence is of length 6 with time steps corresponding to each month used, and each time step is a vector of length 7, where 7 is the number of variables for each month. In the above example, numChannels = 7.
The targets TTrain should be a matrix of size 31-by-3, where the 3 columns are the three values that you would like to predict. In the above example, this would mean that numResponses = 3.
When making predictions, use the predict function. The input data would be a cell array of two observations, where the sequences have the same layout as those in XTrain.
Hope this helps.
Ieuan
Muhammad Usman Saleem
Muhammad Usman Saleem 2022 年 6 月 25 日
編集済み: Muhammad Usman Saleem 2022 年 6 月 25 日
Many thanks for your detail explaination to my problem. I am confuse with this why my number of channels will be 7? I've 41 variables but this line Each sequence is of length 6 with time steps corresponding to each month used, and each time step is a vector of length 7, where 7 is the number of variables for each month. In the above example, numChannels = 7
Dear Sir, I've 41 variables, why my numchannels are 7? its confusing me?
Will you please correct my code according to my problem? If I use wrong code, then error will be multiple in my research?
Many thanks for your kind support..

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSequence 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