- Sequence Input Layer: Set InputSize to 3.
- LSTM Layer: Use a suitable number of hidden units (e.g., 50).
- Fully Connected Layer: Set the number of outputs to 1.
- Regression Layer: For predicting continuous values.
Deep Network Designer for time series forecasting
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I tried the chickenpox dataset example (https://www.mathworks.com/help/deeplearning/ug/time-series-forecasting-using-deep-network-designer.html) using my own data (single time series first) and went very well.
But I have 4 time series of data and I want to train the network to predict the 4th one. This 4th timeseries depends on the 3 others, so I believe that accuracy will be increased if I use them all. I tried to make a matrix (4 x timesteps) as XTrain and for YTrain (1 x timesteps) I used the 4th row. In deep network designer I put in input layer input size = 4 and in fc I put output=1. An error message informed me that I give 1 input but the network expects 4. After that I put input=1 but I'm not sure what I was doing.
Is there an example with multi input and single output? In the time series forecasting (https://www.mathworks.com/help/deeplearning/ug/time-series-forecasting-using-deep-learning.html?searchHighlight=time%20series%20forecast&s_tid=srchtitle_support_results_1_time%20series%20forecast) the channels are confusing me.
What modification could I make in the chickenpox example to give deep network designer 4 time series and ask to predict the 4th?
0 commentaires
Réponses (1)
Jaimin
le 7 Nov 2024 à 9:21
To modify the chickenpox example for a multi-input, single-output time series prediction task, you must configure your input and network architecture to effectively handle multiple input features (the initial three time series) and generate a single output (the fourth time series).
Kindly refer to the following network architecture for understanding.
Kindly refer to the following code snippet to understand the implementation of the above architecture.
% Example data preparation
XTrain = [TS1; TS2; TS3];
YTrain = TS4;
% Define the network architecture
layers = [
sequenceInputLayer(3) % 3 input features
lstmLayer(50, 'OutputMode', 'sequence') % Example LSTM layer
fullyConnectedLayer(1) % Output size of 1
regressionLayer
];
% Training options
options = trainingOptions('adam', ...
'MaxEpochs', 100, ...
'MiniBatchSize', 20, ...
'Plots', 'training-progress', ...
'Verbose', 0);
% Train the network
net = trainNetwork(XTrain, YTrain, layers, options);
% Predict and evaluate
YPred = predict(net, XTest); % Replace XTest with your test data
For more information about “lstmLayer” kindly refer following MathWorks documentation.
I hope this will be helpful.
0 commentaires
Voir également
Catégories
En savoir plus sur Sequence and Numeric Feature Data Workflows dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!