Project Overview
Project: Sentiment Analysis of Amazon Cell Phone Reviews
Dataset: 20191226-reviews.csv
Problem Statement:
Online reviews play a crucial role in the online shopping experience and significantly influence consumers' purchasing decisions. While humans can easily interpret the sentiment of these reviews, the challenge is to determine whether a computer can perform sentiment analysis with similar accuracy. This project aims to address this challenge using Amazon reviews of cell phones.
Dataset Overview
Size: 9000 user reviews
Attributes: Username, date, rating, and review text
Steps Taken
Data Preprocessing:
Cleaning the Data: Removed any null values and irrelevant data points.
Text Preprocessing: Tokenized the text, removed punctuation and stop words, and normalized the case to ensure uniformity.
Sentiment Analysis with NLTK:
Natural Language Processing (NLP): Utilized the Natural Language Toolkit (NLTK), an open-source library, for text processing.
Sentiment Scoring:
Stop Words Removal: Eliminated common words that do not contribute to sentiment (e.g., "and", "the").
Word Sentiment Scoring: Each word in the review was scored based on its sentiment.
Overall Sentiment Calculation: Combined individual word scores to determine the overall sentiment of the review.
Sentiment Categories: Classified reviews into positive, negative, and neutral categories based on their scores.
Compound Scoring: Calculated an overall compound score to determine the general sentiment of the review.
Advanced Sentiment Analysis with Hugging Face Transformers:
Pre-trained Model Usage:
Model: Loaded the pre-trained RoBERTa model and tokenizer from the Hugging Face transformers library.
Implementation: Used 'TFRobertaForSequenceClassification', a TensorFlow implementation of RoBERTa for sequence classification tasks.
Sentiment Classification:
Tokenization: Processed the review text using RoBERTa's tokenizer.
Sequence Classification: Applied the RoBERTa model to classify the sentiment of the review text.
Results and Analysis:
NLTK Sentiment Analysis:
Distribution of Sentiments: Visualized the distribution of positive, negative, and neutral reviews.
Accuracy: Evaluated the accuracy of the sentiment analysis by comparing with human-labeled sentiments.
Insights: Identified key themes and common sentiments in the reviews.
RoBERTa Sentiment Analysis:
Enhanced Accuracy: Achieved higher accuracy and more nuanced understanding of sentiments compared to traditional methods.
Comparative Analysis: Compared results from the NLTK approach with those from RoBERTa to highlight improvements.
Learning and Impact
NLP Techniques: Gained a deep understanding of various NLP techniques and their applications in sentiment analysis.
Model Implementation: Learned to implement and fine-tune pre-trained models for specific tasks.
Comparative Analysis: Improved ability to evaluate and compare the performance of different machine learning models.
Tools used: Python, NLP, TensorFlow, HuggingFace, Jupyter
Models: VADER (Valence Aware Dictionary and sEntiment Reasoner), RoBERTa (Robustly optimized BERT approach)