Please explain input shape in Keras
Question
My data consists of 2-dimensional arrays with shape (2,3).
The whole dataset (emp
) consists of 12 items (I know that it is too small of a number for an NN training, but it is just a test), so it has shape (12,2,3)
truevals
has shape (12,)
When I try to add Keras layer:
model = Sequential()
model.add(Dense(4, input_shape=(2,3), activation='tanh'))
model.add(Dense(1, activation='sigmoid'))
model.compile(SGD(lr=0.5), 'binary_crossentropy', metrics=['accuracy'])
model.fit(emp, truevals, epochs=200)
and then when I fit the model I get the exception:
Error when checking target: expected dense_30 to have 3 dimensions, but got array with shape (12, 1).
What am I doing wrong?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with datascience.stackexchange