# Error when checking target: dimensions error in CNN-LSTM model for multivariate time series forecasting

I'm making a CNN-LSTM model to forecast multivariate time series:

       model = Sequential()
#model.build((10,7,1))
model.compile(optimizer='RMSprop', loss='mse',metrics=['accuracy'])
model.summary()
print('a new model has been created')


I have as input 7 features ("Time series") and a single output.

I made a function (make_samples to sample the data into sliding window size 10 in code called as n_steps

def make_samples(self,file, n_steps):
X, y = list(), list()
for i in range(len(data)):
# find the end of this pattern
end_ix = i + n_steps
# check if we are beyond the dataset
if end_ix > len(data):
break
# gather input and output parts of the pattern
seq_x = data[self.lista].values[i:end_ix]
seq_y = data["Volume"].values[end_ix-1]
X.append(seq_x)
y.append(seq_y)

return array(X).astype("float32"),array(y).astype("float32")


When I pass this data to the model I got the following error:

Error when checking target: expected dense_30 to have 3 dimensions, but got array with shape (659, 1))

The question is, why does this error arise? And, how do I go about fixing this?

Here is the summary of

Layer (type) Output Shape Param

conv1d_38 (Conv1D) (None, 9, 64) 960

conv1d_39 (Conv1D) (None, 8, 128) 16512

max_pooling1d_18 (MaxPooling (None, 4, 128) 0

lstm_18 (LSTM) (None, 4, 200) 263200

dense_29 (Dense) (None, 4, 32) 6432

dense_30 (Dense) (None, 4, 1) 33

• Can you please show us a sample of the data after the make_sampels function. – JahKnows Jul 11 at 13:19