I started to use Keras for ANN and something that I do not really understand is which values to choose for the input_shape parameter of the first layer in an ANN? I know that the number should be equal to the inputs but how can I determine the order and the other value in the vector. For example, here is the code of a Multilayer Perceptron that takes 3 inputs and calculates 1 output
model.add(keras.layers.Flatten(input_shape=[3,])),
model.add(Dense(20, activation='relu'))
model.add(Dense(40, activation='relu'))
model.add(Dense(20, activation='relu'))
model.add(Dense(3, activation='linear'))
In this case I use 'input_shape=[3,]'. The 3 comes from the 3 inputs but why do I have a ",]" as the second argument. Here you see on the other hand the code for a recurrent neural network that is used for time series forecasting and that has 6 input features for every timeslot of the time series and calculates 24 outputs:
model6 = keras.models.Sequential([
keras.layers.SimpleRNN(20, return_sequences=True, input_shape=[None, 6]),
keras.layers.SimpleRNN(20, return_sequences=True),
keras.layers.TimeDistributed(keras.layers.Dense(24))
])
Why do I have here another order with "input_shape=[None, 6]" and not "input_shape=[6, None]" and why do I need here "None" as the first argument and not like in the multilayer perceptron just ",]". Has this something to do with the recurrent neural network such that I always have to use the number of input features as the second argument and 'None' as the first argument.
I read about this in the keras documentation but it is still confusing for me. Can you tell me how to choose those input_shape argument`I'd appreciate every comment.