Quantcast
Channel: How to get data in proper shape to feed to LSTM layer in keras for sequence to sequence prediction - Stack Overflow
Viewing all articles
Browse latest Browse all 2

How to get data in proper shape to feed to LSTM layer in keras for sequence to sequence prediction

$
0
0

I have dataframe as following for time series where SETTLEMENTDATE is index. I want to take first row, i.e 2018-11-01 14:30:00 and values of T_1, T_2, T_3, T_4, T_5, T_6 as a sequence and predict sequence of DE_1, DE_2, DE_3, DE_4.

I am using keras for Sequence to sequence time series using LSTM. I tried to take T_1 to T_6 as input dataframe 'X' and DE_1 to DE_4 as output dataframe 'y'. I reshaped it using X = np.array(X) y = np.array(y) and then X = X.reshape(4,6,1) and y = y.reshape(4,4,1) to feed to batch_input_shape() but it does not work.

How to get data in proper shape to feed to LSTM layer?

                      T_1     T_2     T_3     T_4     T_5     T_6    DE_1    DE_2    DE_3    DE_4
SETTLEMENTDATE                                          
2018-11-01 14:30:00 1645.82 1623.23 1619.09 1581.94 1538.20 1543.48 1624.23 1722.85 1773.77 1807.04
2018-11-01 15:00:00 1628.60 1645.82 1623.23 1619.09 1581.94 1538.20 1722.85 1773.77 1807.04 1873.53
2018-11-01 15:30:00 1624.23 1628.60 1645.82 1623.23 1619.09 1581.94 1773.77 1807.04 1873.53 1889.06
2018-11-01 16:00:00 1722.85 1624.23 1628.60 1645.82 1623.23 1619.09 1807.04 1873.53 1889.06 1924.57

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images