An open API service indexing awesome lists of open source software.

https://github.com/travelxml/amazon-product-reviews-sentiment-analysis-in-python

NPL: Amazon Product Reviews Sentiment Analysis in Python
https://github.com/travelxml/amazon-product-reviews-sentiment-analysis-in-python

ai matplotlib ml nlp nlp-machine-learning nltk numpy pandas pandas-python python3 sentiment-analysis sentiment-classification wordcloud wordcloud-generator wordcloud-visualization

Last synced: 2 months ago
JSON representation

NPL: Amazon Product Reviews Sentiment Analysis in Python

Awesome Lists containing this project

README

          

# NLP: Amazon Product Reviews Sentiment Analysis in Python
![Amazon Reviews](https://github.com/user-attachments/assets/ac6a483a-3aca-464c-98a0-61cddcc0854f)

Unlock the insights hidden in Amazon product reviews with this comprehensive sentiment analysis project. By leveraging machine learning and natural language processing (NLP), this project aims to classify reviews as positive or negative, providing valuable insights into customer sentiments.

## 🚀 Project Overview

This repository provides a step-by-step guide to performing sentiment analysis on Amazon product reviews. The project uses a Logistic Regression model trained on pre-processed review text to predict whether a review is positive or negative.

### Key Features:
- **Data Preprocessing**: Clean and prepare raw review text for analysis using Python libraries like `nltk` and `pandas`.
- **Model Training**: Train a Logistic Regression model to classify the sentiment of reviews.
- **Visualization**: Generate word clouds and confusion matrices to visualize the distribution of sentiments and model performance.
- **Evaluation**: Assess model accuracy with metrics like accuracy score and confusion matrix.

## 📂 Repository Structure

- **`az_senti_analysis.ipynb`**: The Jupyter Notebook that contains the full workflow, from data preprocessing to model evaluation.
- **`data/`**: Directory to store the Amazon review dataset.
- **`requirements.txt`**: List of Python libraries required to run the project.

## 🛠️ Installation

### Prerequisites

Make sure you have Python 3.7+ installed. Clone this repository and navigate to its directory:

```bash
git clone https://github.com/TravelXML/Amazon-Product-Reviews-Sentiment-Analysis-in-Python.git
cd Amazon-Product-Reviews-Sentiment-Analysis-in-Python
```

### Install Dependencies

Use pip to install the necessary Python libraries:

```bash
pip install -r requirements.txt
```

## 📊 Usage

1. **Download the Dataset**: Ensure the Amazon product reviews dataset is placed in the `data/` directory. The dataset should be in CSV format.
2. **Run the Notebook**: Open and execute `az_senti_analysis.ipynb` in Jupyter Notebook or JupyterLab to perform sentiment analysis.
3. **Visualize Results**: Explore the generated visualizations to understand the sentiment distribution across the dataset.

## 🎯 Example Outputs

### Word Cloud
Visualize the most frequent words in positive and negative reviews:
![Word Cloud](https://github.com/user-attachments/assets/7ef70f56-e4e5-496c-ba30-9bfdb613eccd)

### Confusion Matrix
Evaluate model performance with a confusion matrix:
![Confusion Matrix](https://github.com/user-attachments/assets/33e86db9-434c-4af5-b87d-2a2fffb218be)

## 🤝 Contributing

Contributions are welcome! Whether it's fixing bugs, improving the documentation, or adding new features, feel free to open a pull request or submit an issue.

## 📧 Contact

For questions or collaborations, reach out via [LinkedIn](https://www.linkedin.com/in/the-startup-cto/).

Happy Coding