LSTM with embedding

Hi everyone,
I am trying to create a model in keras which is composed by a embedding layer, a lstm and a dense layer. The input and output of the model is a sequence of numbers.The problem comes when I fit the model. It always says the same error “UnimplementedError: Cast string to float is not supported”. Some examples of the input and output are:
Should I use a different kind of model or should i do something special to the input and output?

1 Like

NNs understand only numeric inputs / outputs.
Based on this Cast string to float is not supported, please check the dtype of inputs and output(s).

If you’re building an RNN model that deals with letters or words from a vocabulary, the normal method is to convert those into either a categorical (index into the set) or a “one hot” representation, so that they are numeric values. There were plenty of examples of how to convert between categorical and one hot representations in the lectures and assignments.

Thank you for the replies
I have converted both sequences into a np.array with the different numbers with the float function.

X['inp'] = X['inp'].apply(lambda x:[(*x)])
X['inp'] = X['inp'].apply(lambda x:[float(a) for a in x])
X['inp'] = X['inp'].apply(lambda x:np.array(x, dtype=np.float))
X['inp'] = X['inp'].apply(lambda x:np.expand_dims(x, -1))

This as a result transforms the values of the rows which were a string to a numpy array with the different values of the sequence. I have also tried without reshaping and using a tensor instead of a np array and it always results in the same error.
ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type numpy.ndarray).

PD: I am using Datalore

Every number of the input sequence is a time step