I am trying to understand how to use LSTM to classify a specific dataset that I have.
I researched and found this keras and imdb example: https://github.com/fchollet/keras/blob/master/examples/imdb_lstm.py
However, I was confused about how the data set should be processed for input.
I know keras has pre-processing of text methods, but I'm not sure what to use.
x contains n lines with texts, and y classifies the text according to happiness / sorrow. Basically, 1.0 means 100% happy, and 0.0 means completely sad. numbers can vary, e.g. 0.25 ~~ etc.
So my question is: how to enter x and y? Should I use a bag of words? Any feedback is appreciated!
I coded this below, but I keep getting the same error #('Bad input argument to theano function with name ... at index 1(0-based)', 'could not convert string to float: negative')
import keras.preprocessing.text import numpy as np np.random.seed(1337)
source share