How to use LSTM and CNN to handle a regression problem?

168 ビュー (過去 30 日間)
Hui Li
Hui Li 2020 年 7 月 14 日
コメント済み: rohini sharma 2022 年 10 月 20 日
Hi, everyone!
I am working on a solar power prediction problem. The inputs of the network are some kinds of meteological data, and the outputs are multiple time-series solar power curves. I want to build a neural network combining LSTM and CNN to realize this function. I build a network without error like this:
layers1 = [...
sequenceInputLayer([25 168 1],'Name','input') % 25 is the number of feature dimension of meteological data, and 168 is the length of time series
lgraph = layerGraph(layers1);
lgraph = connectLayers(lgraph,'fold/miniBatchSize','unfold/miniBatchSize');
However, the flattenLayer destory the time series, and the training cannot be finished.
Therefore, is there any solution about this problem? Or is there any other correct network can realize the same function?
Thanks in advance for your time and kindly help!
  1 件のコメント
Davey Gregg
Davey Gregg 2022 年 4 月 6 日
編集済み: Davey Gregg 2022 年 4 月 6 日
How are you arranging the data into predictors and responses? I'm trying to do something similar and I just keep getting the "Invalid training data." error.


回答 (3 件)

H Sanchez
H Sanchez 2021 年 4 月 30 日
To Whoever is looking for a CNN-RNN
I have created a simple template for hybrids cnn-rnn for time series forecasting.
  1 件のコメント
Muhammad Waqar
Muhammad Waqar 2021 年 12 月 22 日
This is an excellent contribution.


Abolfazl Nejatian
Abolfazl Nejatian 2020 年 12 月 10 日
編集済み: KSSV 2022 年 8 月 7 日
Dear Gupta,
i have written a prediction code that uses CNNs and LSTM to forecast future values.
please visit my Mathworks page,
  5 件のコメント
Imola Fodor
Imola Fodor 2022 年 3 月 3 日
what are the changes we need for the real time prediction? i have developed a regression model (for sysid) 1dcnn + LSTM on 1500 timesteps, and it works well, but when giving an input of 500 it is performing badly..i suppose the model needs the full input sequence to perform well, which is not what i would need


Raunak Gupta
Raunak Gupta 2020 年 7 月 19 日
I am unable to understand what exactly you are doing with input and output of the network, but I think its related to either sequence to sequence regression or time series forecasting. You may follow below mentioned examples for both cases and see if it matches with your application.
  4 件のコメント
rohini sharma
rohini sharma 2022 年 10 月 20 日
is lstm can be applied in 2018 a matlab please reply



Find more on Deep Learning Toolbox 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!

Translated by