This project analyzes product reviews to classify them as either positive or negative sentiment. It explores various Natural Language Processing (NLP) techniques, from classic machine learning models to a Recurrent Neural Network (RNN).
The goal of this project is to build and evaluate different models for sentiment classification. The process includes:
- Text Pre-processing: Cleaning and preparing the raw review text for analysis.
- Vectorization: Converting text into numerical features using Bag-of-Words, TF-IDF, and Word2Vec.
- Model Training: Implementing and comparing multiple classification models.
- Evaluation: Measuring the accuracy and performance of each model.
- Data Manipulation: Pandas
- Text Pre-processing: NLTK
- Vectorization: Scikit-learn (CountVectorizer, TfidfVectorizer), Gensim (Word2Vec)
- Machine Learning Models:
- Logistic Regression
- K-Nearest Neighbors (KNN)
- Naive Bayes
- Recurrent Neural Network (RNN) with TensorFlow/Keras
- Visualization: Matplotlib, WordCloud
The performance of the models varied significantly based on the vectorization technique.
| Model | Vectorization | Test Accuracy |
|---|---|---|
| K-Nearest Neighbors | Word2Vec | 94.0% |
| Naive Bayes | Word2Vec | 88.0% |
| Recurrent Neural Network (RNN) | Embedding Layer | 96.0% |
The Recurrent Neural Network (RNN) achieved the highest accuracy of 96.0%, demonstrating its strength in understanding sequential text data for sentiment classification.
(To add images, you can take screenshots of your word clouds, upload them to the repository, and then reference them here.)
- Clone the repository:
git clone [https://github.com/YOUR_USERNAME/YOUR_REPOSITORY_NAME.git](https://github.com/YOUR_USERNAME/YOUR_REPOSITORY_NAME.git)
- Navigate to the project directory:
cd YOUR_REPOSITORY_NAME - Install the required libraries:
pip install -r requirements.txt
- Open and run the
sentiment_analysis_nlp.ipynbnotebook in a Jupyter environment.