This repository contains Python code for a project that focuses on sentiment analysis of product reviews. The project implements and compares three types of linear classifiers: the perceptron algorithm, the average perceptron algorithm, and the Pegasos algorithm. It uses a dataset of product reviews from Amazon customers and explores the impact of different features on classifier performance. The reviews, originally given on a 5-point scale, have been adjusted to a +1 or -1 scale, representing a positive or negative review, respectively.
- Objective: Develop a sentiment analysis classifier for product reviews.
- Dataset: Reviews written by Amazon customers for various food products.
- Classification Task: Given a review, classify it as positive (+1) or negative (-1).
project1.py
: Implementation of learning algorithms and hinge loss functions.main.py
: Script for running experiments using the implemented classifiers.utils.py
: Utility functions provided by the project staff.test.py
: Script to run tests on the implemented methods.data/
: Folder containing the dataset in.tsv
format.stopwords.txt
: List of stopwords for text preprocessing.README.md
: This README file.
- Python version: 3.8
- Required libraries: NumPy, Matplotlib
- Clone this repository to your local machine:
git clone https://github.com/your-username/Sentiment-Analysis-of-Amazon-Customers-Reviews-for-Food-Products-Using-Machine-Learning-Approach.git
Experiment with different features and hyperparameters to achieve the best classifier performance. You can visualize and analyze the results using Matplotlib in main.py.
Contributions are welcome! If you find any issues or have improvements to suggest, please open an issue or submit a pull request.
This project is part of the Machine Learning with Python course at MITx.