I want to train a Sequential Neural Net (NN) with Tensorflow.
bidding_nn = tf.keras.Sequential([
tf.keras.layers.Dense(units=128, activation='elu', kernel_initializer='he_uniform'),
#tf.keras.layers.Flatten(),
tf.keras.layers.Dense(units=128, activation='elu', kernel_initializer='he_uniform'),
tf.keras.layers.Dense(units=9, activation='softmax', kernel_initializer='he_uniform'),
])
and
adam = Adam(lr=0.02, decay=0.01)
bidding_nn.compile(optimizer='adam',
loss=tf.keras.losses.CategoricalCrossentropy(),
metrics=['accuracy'])
bidding_nn.fit(train_dataset, epochs=10)
It should tell me probabilities for the 9 categories I have.
So as input for the NN, I have 8 npArrays of lengths 32 (one-hot encoded) and as output 1 npArray of lengths 9 (one-hot encoded).
(Pdb) train_dataset
<TensorSliceDataset shapes: ((8, 32), (9,)), types: (tf.float64, tf.float64)>
However, at bidding_nn.fit(train_dataset, epochs=10)
I get the error message
ValueError: Shapes (9, 1) and (8, 9) are incompatible
++++++++++++++++++++++ Answer to the problem, see https://stackoverflow.com/a/66350991/12368039
ValueError
you received? $\endgroup$.fit()
in herebidding_nn.fit(train_dataset, epochs=10)
$\endgroup$