I want to input a numpy 2d array into MLP but I have an array of 50395 rows that contains many 2d array of shape (x, 129)
. x
because some matrices have different row numbers. Here is an example :
train['spec'].shape
>>(50395,)
train['spec'][0].shape
>>(41, 129)
train['spec'][5].shape
>>(71, 129)
Here an snippet of my code :
X_train = train['spec'].values; X_valid = valid['spec'].values
y_train = train['label'].values; y_valid = valid['label'].values
model.add(Dense(12, input_shape=(50395, ), activation='relu'));
model.fit(X_train, y_train, validation_data=(X_valid, y_valid), epochs=500, batch_size=1);
I get this error on last line (model.fit
) :
ValueError: Error when checking input: expected dense_54_input to have shape (50395,) but got array with shape (1,)
How to fix this problem so that the network can take as input all 50395
matrices of shape (x, 129)
?