Sentiment-classification-of-Amazon-fine-food-reviews
Sentiment-classification-of-Amazon-fine-food-reviews copied to clipboard
A deep learning model (Bidirectional LSTM) using pretrained word embeddings to do sentiment analysis on Amazon fine food reviews dataset.
Sentiment classification of Amazon fine food reviews
A sentiment analysis implementation on the Amazon fine food reviews dataset.
Overview
In this implementation, i used pretrained word embeddings GloVe 100d as the input of my deep learning model using Bidirectional LSTM.
Created by Ngo Quang Huy @ngoquanghuy99
Email: [email protected]
Results on testing set
label | precision | recall | f1-score | support |
---|---|---|---|---|
0 | 0.79 | 0.73 | 0.76 | 11394 |
1 | 0.95 | 0.96 | 0.96 | 61388 |
accuracy | 0.93 | 72782 |
Getting started
Install dependencies
Requirements
-
tensorflow>=2.3.1
-
keras>=2.4.3
$ pip3 install -r requirements.txt
Training
$ python train.py
Accuracy graph:
Loss graph:
Fine tuning model by changing hyperparameters in config.py
Testing
On the assumption that you want to predict directly
$ python test.py --review "this is the worst thing i\'ve ever bought"
Output:
$ 'this is the worst thing i've ever bought' is NEGATIVE 82.63011127710342%