I am trying to use LSTMs to train and predict authors using reviews data and metadata
author phone country day review
james iphone chile tuesday the book was really amazing
How do i pass all these features into the network?
Data Science Stack Exchange is a question and answer site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field. It only takes a minute to sign up.
Sign up to join this communityI am trying to use LSTMs to train and predict authors using reviews data and metadata
author phone country day review
james iphone chile tuesday the book was really amazing
How do i pass all these features into the network?
Since the review of an author is bound to change in terms of the number of words being used in the review, I would suggest using a Keras Sequential() model to build an LSTM encoder for the review itself. The final hidden layer of the Review LSTM encoder can then be fed into another LSTM encoder with 3 words (phone, country and day). Think of the last LSTM encoder as a sequential 3 worded message. The final layer of this LSTM can then be joined with a softmax layer to predict the author.
The reason I suggested two different LSTM has something to do with word embeddings. Word embeddings are basically features that get modified in multiple hidden layers in an LSTM. Having two different word embeddings means that the same word in the Review Embedding may mean different in the other LSTM embedding, ie have different embedding vectors after training. It ensures that the features are independent. You can argue that you might need 4 different LSTM and Embedding Layers because of 4 different features. That is definitely a viable option but it might need a lot more time to train. Having more LSTM will add hyperparameters significantly and training time will be really high.
That being said you may not need an LSTM to solve this problem. You can easily convert the phone, country and day values into integers. There are 7 days in a week so the value of day can only be one from 0 to 6. That reduces the dimension of features significantly, reducing training time. You can probably try a TF-IDF for the review feature or a naive bag of word model and use a Random Forest or SVM Classifier for the prediction of Author. It would be interesting to perform multiple experiments with and without LSTM and observe results with accuracy and performance.