I have been working on a project for estimating the traffic flow using time series data combine with weather data. I am using a window of 30 values for my time series and I am using 20 weather related features. I have used the functional API to implement this, but I keep getting the same error and I do not know how it can be solved. I have looked at other similar threads such as this one Input 0 of layer conv1d_1 is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: [None, 200], but it has not helped.
This is my model,
series_input = Input(shape = (series_input_train.shape[1], ), name = 'series_input')
x = Conv1D(filters=32, kernel_size=5, strides=1, padding="causal", activation="relu")(series_input)
x = LSTM(32, return_sequences = True)(x)
x = LSTM(32, return_sequences = True)(x)
x = Dense(1, activation = 'relu')(x)
series_output = Lambda(lambda w: w * 200)(x)
weather_input = Input(shape = (weather_input_train.shape[1], ), name = 'weather_input')
x = Dense(32, activation = 'relu')(weather_input)
x = Dense(32, activation = 'relu')(x)
weather_output = Dense(1, activation = 'relu')(x)
concatenate = concatenate([series_output, weather_output], axis=1, name = 'concatenate')
output = Dense(1, name = 'output')(concatenate)
model = Model([series_input, weather_input], output)
The shapes of series_input_train
and weather_input_train
are (34970, 30) and (34970, 20) respetively.
The error I keep getting is this one,
ValueError: Input 0 of layer conv1d is incompatible with the layer: : expected min_ndim=3, found ndim=2. Full shape received: (None, 30)
What am I doing wrong?
Honestly, I have always had trouble figuring out how the shape of the inputs work in TensorFlow. If you could point me in the right direction, it would be appreciated but what I need right now is a fix for my model.