问题
I'm new to Keras, and I find it hard to understand the shape of input data of the LSTM layer.
The Keras Document says that the input data should be 3D tensor with shape (nb_samples, timesteps, input_dim).
I have 808 signals.
And each signal has 22 channel and 2000 data points.
Data_shape : (808,22,2000)
Also i have 808 labels for each signal.
Label_shape : (808,2)
Label[1,:] = [1,0]
I want to analyze with slice 2000 data points into 20 time steps, and each time steps(lstm cell) receive 100 data points.
In my thought, there are 20 LSTM cells and each LSTM cell receive (22,100) data which is 100 data points with 22 channel(features).
so here is my questions
What is the right input shape for Keras LSTM in my data case?
And what should i change value on my LSTM model?
I had tried in this way now. I'm not sure with input shape.print(X_train.shape) print(y_train.shape) (727, 22, 2000) (727, 2) model = Sequential() model.add(LSTM(20, input_shape=(22,2000), dropout=0.2, recurrent_dropout=0.2, return_sequences=True)) model.add(Dense(20)) model.add(LSTM(20, dropout=0.2, recurrent_dropout=0.2)) model.add(Dense(2, activation='softmax')) model.compile(loss='binary_crossentropy', optimizer='Adadelta', metrics=['accuracy'])
What should i do with my data shape?
Should i reshape my data to another shape?
来源:https://stackoverflow.com/questions/47726870/how-can-i-reshape-my-data-for-keras-lstm-input