Where should I eat after the pandemic?: Decision Making with Aspect-Based Sentiment Analysis Using Transformers.
Exploring the Yelp dataset using Aspect-Based Sentiment Analysis.
To install all the required libraries run,
$ pip install -r requirements.txt
The following code is associated with the first Medium article of my 2 part series.
Run the setup script to create all the proper files and directories. Use the --skip-yelp
flag to skip downloading the Yelp dataset from Kaggle.
$ python setup.py --skip-yelp
For the model_id
parameter, you can select any model from the transformers
library that supports sentence-pair classification.
Train the model by running the following command:
$ python train.py --model-id=distilbert-base-uncased --epochs=4 --batch-size=24 --lr=5e-2
These are the models I've used on this task:
prajjwal1/bert-tiny
prajjwal1/bert-small
distilbert-base-uncased
bert-base-uncased
Of these models, I've found distilbert
to be the best.
The following is code associated with the second article of the 2 part Medium series. Make sure that you have run part 1 before running any of the following. Additionally, make sure you have kaggle setup on your computer.
The following will download the data from Yelp:
$ python setup.py
Run the trained model over all tips in the Yelp dataset using,
$ python run.py --model-id=distilbert-base-uncased --batch-size=15
Generate all charts associated with your trained model, as shown in the Medium article.
$ python make_charts.py --model-id=distilbert-base-uncased
Find out your results by choosing your importance weights for each aspect of a restaurant.
$ python find.py --model-id=distilbert-base-uncased --importances=7,9,10,5,5,2