I am new to deep learning and I am trying to build a book recommender system using embedding layers. I use one layer for the book and one for the user.

I am having trouble with fitting the model. More specifically, when I try to feed the first layer with the books' ISBN list I get back the " ValueError : could not convert string to float: '087584877X' ".

Note that a book's ISBN ( as '087584877X' for example ) is either a sequence of numbers or a sequence of letters and numbers. The second category seems to be the problematic one.

I dont get why it should convert the string to float. I though that what the network does is to assign each string to a new integer regardless of the structure of the string.

Here is my code for the books embedding layer :

book_input = Input(shape=(1,))

book_embedding = Embedding(input_dim = n_books+1, output_dim = 4)(book_input)

It looks like you're using Keras, so this answer is going to refer to the Keras embedding layer.

The error message is pretty clear - Keras embedding layers don't accept strings as inputs. The embedding layer requires an array of positive integers and can only be used as the first layer of a model. The embedding layer requires that you encode each word as an integer so you might have to use the Keras tokenizer.

Source: Embedding Layers

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.