# Problems with class embedding in keras

I am doing a toy example with mushroom dataset to learn class embedding with keras:

I am trying to embed a single feature:

inputs = Input(shape=[1])
emb = Embedding(input_dim=cap_shape_dummy.shape[1], output_dim=3)(inputs)
output = Dense(units=1,activation='sigmoid')(emb)
model = Model(inputs=inputs,outputs=output)


However I always receive the same error when I try to fit the model:

Error when checking target: expected dense_2 to have 3 dimensions, but got array with shape (8124, 1)


Am I doing anything wrong? Did I miss anything with category embedding?
Thanks.

• I think your problem can be solved by adding 'model.add(Flatten())' before the dense layer, or see the answer of this question: stackoverflow.com/questions/48674881/… – Hunar Apr 11 '19 at 9:01
• Why would I need to Flatten? the output fronm my embedding is not multi dim? Would you please explain me what each param mean? because maybe is not clear – 3nomis Apr 11 '19 at 12:15