How to calculate input_dim for a keras sequential model?

In your case lets assume x and y=target variable and are look like as follows after feature engineering

x.shape
(1000000, 3)
y.shape
((1000000, 1600)
# as first layer in a sequential model:
model = Sequential()
model.add(Dense(32, input_shape=x.shape[1])) # Input layer
# now the model will take as input arrays of shape (*, 3)
# and output arrays of shape (*, 32)
...
...
model.add(Dense(y.shape[1],activation='softmax')) # Output layer

y.shape[1]= 1600, the number of output which is the number of classes you have, since you are dealing with Classification.


input_dim is the number of dimensions of the features, in your case that is just 3. The equivalent notation for input_shape, which is an actual dimensional shape, is (3,)