I am trying to use an LSTM model for binary classification on multivariate time series data. I have seven properties collected over the course of the day for about 100 days (i.e. 100 arrays of size [9000, 7]). Each of these arrays has a single classification status of either 1 or 0.
I've started out trying to build the simplest model possible given that I am new to Keras and Machine Learning in general, but I keep getting errors regarding input shape when I try to train them. For example, my first layers:
model = Sequential()
model.add(Conv2D(32, (3,3), input_shape=(9000,7,1), activation='relu'))
...
model.fit(x=X_train, y=Y_train, epochs=100)
With an X_train of type float64, and a size of (100L, 9000L, 7L), I get an error that reads:
ValueError: Error when checking input: expected conv2d_11_input to have 4 dimensions, but got array with shape (100L, 9000L, 7L)
I've tried changing the batch size and number of epochs with no sucess so can someone explain how to correctly reshape my input? Am I missing something simple?
I suspect you want to use a Conv1D
(3D data), no?
You're using a Conv2D
(4D data = images).
For either Conv1D
and any of the RNN
layers, such as LSTM
, your input is 3D data and your input_shape
should be input_shape=(9000,7)
.
The input data should be an array with shape (100,9000,7)
, which is already ok, by the content of the error message.
Assuming each day is an individual sequence and you don't want to connect days.