Final Project: Comparing Lexicon-Based and Machine Learning Approaches for Sentiment Analysis (VADER vs. Logistic Regression)
This project aims to analyze sentiment in Amazon, IMDB, and Yelp reviews using two different approaches:
- Lexicon-Based Method: VADER (Valence Aware Dictionary and sEntiment Reasoner)
- Machine Learning-Based Method: Logistic Regression
By comparing both techniques, we aim to evaluate their strengths, weaknesses, and real-world applicability.
-
Clone the repository:
git clone https://github.com/MohammadA98/SentimentLabelledSentences.git
Please ensure your kernel's virtual environment (conda, venv) is at least python version 3.9 and your terminal is attached your kernel.
-
Navigate to the project directory:
cd SentimentLabelledSentences -
Install required libraries: Run the following command in the terminal:
pip install -r requirements.txt
-
Run the Jupyter Notebook (ensure you have Jupyter installed):
- Open Jupyter Notebook and click
Run All, or - Run the following command in the terminal:
jupyter nbconvert --to notebook --inplace --execute sentiment.ipynb
This will execute all notebook cells, install required libraries, and display results.
- Open Jupyter Notebook and click
-
(Optional) Extract the real-life experiment dataset:
The tweets.csv file is large, so a compressed version (tweets_compressed.zip) is included instead. Extracting this file is only necessary if you want to run the real-life experiment portion of the code. Otherwise, you can proceed without it.
If needed, extract the dataset using:
unzip tweets_compressed.zip
This will extract tweets.csv into the project directory.
This project explores sentiment analysis by:
✔ Preprocessing and cleaning raw text data.
✔ Performing Exploratory Data Analysis (EDA) to understand sentiment distribution.
✔ Building and evaluating sentiment classification models.
✔ Comparing lexicon-based and ML-based models for real-world sentiment analysis.
✔ Experimenting on real-world data, such as:
- Sentiment of each tweet in a large collection dataset.
The dataset contains sentiment-labeled reviews from multiple sources:
| Source | Description |
|---|---|
| Amazon Reviews | User feedback on various products. |
| IMDB Reviews | Movie reviews from online users. |
| Yelp Reviews | Restaurant and service reviews. |
| Tweets | Over a million and a half tweets. |
Each review is labeled as positive (1) or negative (0) for supervised learning.
This project incorporates:
- Natural Language Processing (NLP)
- Supervised Machine Learning
- Feature Engineering (TF-IDF)
- Sentiment Lexicon Analysis (VADER)
- Model Evaluation (ROC Curve, AUC, Classification Reports, etc.)
- Python
- NLTK (Natural Language Toolkit)
- scikit-learn (Machine Learning)
- Matplotlib & Seaborn (Data Visualization)
- Jupyter Notebook
- GitHub: MohammadA98
- LinkedIn: Mohammad Alhabli
This project is licensed under the MIT License. See the LICENSE file for details.