Data Science Asked on February 7, 2021
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.
inputs = Input(shape=[1]) emb = Embedding(input_dim=cap_shape_dummy.shape[1], output_dim=3)(inputs) x = Flatten()(emb) output = Dense(units=1,activation='sigmoid')(x) model = Model(inputs=inputs,outputs=output)
Answered by user100853 on February 7, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP