Time Series Forecasting Using Deep Learning with NARX dataset

6 次查看(过去 30 天)
Hi
I am studying and trying to solve a problem, but my school isnt great and I have no I do not know where to find the information to solve the problem. I am just looking for WHERE i can find the solution, no the solution itself.
I have used Time Series Forecasting Using Deep Learning (https://au.mathworks.com/help/deeplearning/ug/time-series-forecasting-using-deep-learning.html#) which has been quite helpful but when i get to training the network (step 8) it is failing, with error:
"Error using trainNetwork. Invalid training data. Predictors must be a N-by-1 cell array of sequences, where N is the number of sequences. All sequences must have the same feature dimension and at least one time step."
The question in whole is:
Use the nonlinear autoregressive network with exogenous inputs (NARX) dataset with the following command in MATLAB. data = simplenarx_dataset;
Perform the following tasks using MATLAB.
1- Plot the sample data set and label the axis.
2- Split the sample dataset into parts, 90% for training and 10% for testing.
3- Standardize the training and testing data to have zero mean and unit variance.
4- Specify the responses to be the training sequences with the values shifted by a one-time step.
5- Create a long short-term memory (LSTM) network
6- Create a long short-term memory (LSTM) network with 200 hidden units.
7- Set the solver to 'adam' and train for 250 epochs.
8- Train the LSTM network.
9- Forecast the values of multiple time steps in the future.
10- Plot the training time series with the forecasted values (Training Data + Forecasted Data).
11- Compare the forecasted values with the test data by plotting the root-mean-square error (RMSE), observed and forecast data.
Thanks for any assistance

回答(1 个)

Vatsal
Vatsal 2023-10-5
Hi glenn,
I understand that you're encountering an error while performing time series forecasting using deep learning. The dataset you're using, the NARX dataset, is a 1x100 cell array where each value of the cell array represents a single value. As a result, the steps mentioned in the provided link cannot be directly applied. However, you can use the following lines of code to obtain the "XTrain" and "TTrain" values:
timeSeriesData = cell2mat(dataTrain); % Convert cell array to a numeric array
XTrain = timeSeriesData(1:end-1);
TTrain = timeSeriesData(2:end);
After updating these values, you can update the next steps accordingly. This should help resolve the error.
I hope this helps!

类别

Help CenterFile Exchange 中查找有关 Sequence 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