EDIT: Now I didn't convert to list.
I am training LSTM for multiple time-series in an array which has a structure: 450x801. There are 450 time series with each of 801 timesteps / time series. The labels are classes with assigned integer from 1 to 6, so the dimension of the label is 450x1. This is my implmentation:
This is my code:
def readData(): labels = pd.read_csv('label.csv', header = None) labels = labels.values data = pd.read_csv('data.csv', header = None) return data, labels data, labels = readData() data_train, data_test, labels_train, labels_test = train_test_split(data, labels) model = Sequential() model.add(LSTM(units=32, input_shape = (450,801,1))) model.add(Dense(6, activation='softmax')) model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
Now I got this error:
Error when checking input: expected lstm_26_input to have 3 dimensions, but got array with shape (450, 801)
Any idea how to solve it?
For instance I can try to reshape:
data_train = np.reshape(data_train, (data_train.shape, 1, data_train.shape)) data_test = np.reshape(data_test, (data_test.shape, 1, data_test.shape))
And now the error is:
raise ValueError('Must pass 2-d input') ValueError: Must pass 2-d input