I'm getting this error:
ValueError: Error when checking input: expected Sequence to have 3 dimensions, but got array with shape (500, 400)
These are the below codes that I'm using.
print(X1_Train.shape)
print(X2_Train.shape)
print(y_train.shape)
Output (here I've 500 rows in each):
(500, 400)
(500, 1500)
(500,)
400 => timesteps (below)
1500 => n (below)
Code:
timesteps = 50 * 8
n = 50 * 30
def createClassifier():
sequence = Input(shape=(timesteps, 1), name='Sequence')
features = Input(shape=(n,), name='Features')
conv = Sequential()
conv.add(Conv1D(10, 5, activation='relu', input_shape=(timesteps, 1)))
conv.add(Conv1D(10, 5, activation='relu'))
conv.add(MaxPool1D(2))
conv.add(Dropout(0.5))
conv.add(Conv1D(5, 6, activation='relu'))
conv.add(Conv1D(5, 6, activation='relu'))
conv.add(MaxPool1D(2))
conv.add(Dropout(0.5))
conv.add(Flatten())
part1 = conv(sequence)
merged = concatenate([part1, features])
final = Dense(512, activation='relu')(merged)
final = Dropout(0.5)(final)
final = Dense(num_class, activation='softmax')(final)
model = Model(inputs=[sequence, features], outputs=[final])
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
return model
model = createClassifier()
# print(model.summary())
history = model.fit([X1_Train, X2_Train], y_train, epochs =5)
Any insights?