Skip to content

About

Professional VADER sentiment analysis on IMDb movie reviews with comprehensive evaluation and error analysis (๐Ÿ“‰,๐Ÿ“ˆ)

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

ย 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฌ Movie Review Sentiment Analysis

LinkedIn GitHub

Python Version NLTK VADER Accuracy License Status

๐Ÿค– Professional VADER Sentiment Analysis on IMDb Movie Reviews

Comprehensive NLP project analyzing 2,000 movie reviews with advanced error analysis and statistical evaluation

๐ŸŽฏ Project Overview

This project implements VADER (Valence Aware Dictionary and sEntiment Reasoner) sentiment analysis on the famous IMDb Movie Reviews Dataset containing 2,000 movie reviews. The goal is to automatically classify movie reviews as positive or negative sentiment and evaluate the performance against human-labeled ground truth.

๐Ÿ” Key Highlights

  • Dataset: 2,000 IMDb movie reviews (1,000 positive, 1,000 negative)
  • Algorithm: NLTK VADER Sentiment Intensity Analyzer
  • Performance: 63.67% accuracy with detailed analysis
  • Challenge: Understanding complex human semantics in movie reviews
  • Analysis: 20+ professional visualizations and statistical tests

๐Ÿง  What Makes This Project Special

Unlike simple text classification, this project tackles the challenging problem of sentiment analysis in movie reviews, where:

  • Reviews often contain mixed sentiments
  • Sarcasm and irony are common
  • Context matters more than individual words
  • Final judgments may appear only at the end of long reviews

๐Ÿ“Š Key Results

โœ… Overall Accuracy: 63.67%
๐Ÿ“Š Total Reviews Analyzed: 1,938
โœ”๏ธ Correct Predictions: 1,234
โŒ Incorrect Predictions: 704

๐Ÿ“ˆ Performance Breakdown:
โ€ข Precision (Negative): 72.0%
โ€ข Precision (Positive): 60.0%
โ€ข Recall (Negative): 44.0%
โ€ข Recall (Positive): 83.0%
โ€ข F1-Score (Macro): 62.0%

๐Ÿš€ Quick Start

Prerequisites

Python 3.7+
pip install -r requirements.txt

Installation

# Clone the repository
git clone https://github.com/Ahmadhammam03/movie-sentiment-analysis.git
cd movie-sentiment-analysis

# Create virtual environment
python -m venv sentiment_env
source sentiment_env/bin/activate  # On Windows: sentiment_env\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Download NLTK data
python -c "import nltk; nltk.download('vader_lexicon')"

Run the Analysis

# Launch Jupyter Notebook
jupyter notebook

# Open and run the enhanced notebook
# -> Sentiment-Analysis.ipynb

๐Ÿ“ Project Structure

movie-sentiment-analysis/
โ”‚
โ”œโ”€โ”€ ๐Ÿ““ Sentiment-Analysis.ipynb                       # Main analysis notebook
โ”œโ”€โ”€ ๐Ÿ“Š data/
โ”‚   โ””โ”€โ”€ moviereviews.tsv                              # Movie reviews dataset
โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ assets/                                        # Generated visualizations
โ”‚   โ”œโ”€โ”€ sentiment_analysis_banner.png                 # Project banner
โ”‚   โ”œโ”€โ”€ confusion_matrix.png                          # Confusion matrix visualization
โ”‚   โ”œโ”€โ”€ sentiment_distribution.png                    # Data distribution plot
โ”‚   โ”œโ”€โ”€ methodology_flow.png                          # Process flow diagram
โ”‚   โ””โ”€โ”€ error_examples.png                            # Error analysis examples
โ”œโ”€โ”€ ๐Ÿ“‹ requirements.txt                               # Python dependencies
โ”œโ”€โ”€ ๐Ÿ“„ README.md                                      # Project documentation
โ”œโ”€โ”€ ๐Ÿ“œ LICENSE                                        # MIT License
โ””โ”€โ”€ ๐Ÿšซ .gitignore                                     # Git ignore rules

๐Ÿ”ฌ Methodology

1. Data Preprocessing

  • Data Loading: Import 2,000 movie reviews from TSV file
  • Data Cleaning: Remove NaN values and empty strings
  • Quality Assessment: Analyze text length and characteristics

2. VADER Sentiment Analysis

from nltk.sentiment.vader import SentimentIntensityAnalyzer

# Initialize VADER analyzer
sid = SentimentIntensityAnalyzer()

# Generate sentiment scores
scores = sid.polarity_scores(review_text)
# Returns: {'neg': 0.121, 'neu': 0.778, 'pos': 0.101, 'compound': -0.9125}

3. Performance Evaluation

  • Classification Metrics: Accuracy, Precision, Recall, F1-Score
  • Error Analysis: False positives/negatives with examples
  • Statistical Testing: Mann-Whitney U tests for significance
  • Visualization: 20+ professional charts and dashboards

๐Ÿ“ˆ Key Findings

๐ŸŽฏ VADER Strengths:

  • โœ… High recall for positive reviews (83%) - excellent at finding positive sentiment
  • โœ… Good precision for negative reviews (72%) - confident negative predictions
  • โœ… Fast processing (500+ reviews/second)
  • โœ… No training required - ready-to-use approach
  • โœ… Interpretable results with sentiment components

โš ๏ธ VADER Limitations:

  • โŒ 542 false positives - struggles with negative reviews containing positive words
  • โŒ Limited context understanding beyond individual words
  • โŒ Difficulty with sarcasm, irony, and mixed sentiments
  • โŒ Challenges with delayed judgment patterns in movie reviews

๐Ÿ’ก Research Insights:

  • Movie reviews exhibit complex sentiment structures not easily captured by lexicon-based methods
  • Many reviews discuss positive aspects before delivering negative final judgment
  • Context and discourse structure matter more than individual word sentiment
  • The decision boundary may need domain-specific optimization

๐ŸŽจ Visualizations

The project includes comprehensive visualizations:

  • Dataset Analysis Dashboard (4-panel overview)
  • Sentiment Score Analysis (9-panel comprehensive view)
  • Performance Evaluation Dashboard (9-panel metrics analysis)
  • Error Analysis Visualizations (detailed error patterns)
  • Final Summary Dashboard (key findings and recommendations)

๐Ÿ› ๏ธ Technical Stack

Core Libraries

  • pandas: Data manipulation and analysis
  • numpy: Numerical computing
  • nltk: Natural Language Processing toolkit with VADER
  • scikit-learn: Machine learning metrics and evaluation
  • matplotlib/seaborn: Professional data visualization
  • scipy: Statistical analysis and significance testing

๐Ÿ“š Dataset Information

Source

  • Original Dataset: Cornell Movie Review Data v2.0
  • Authors: Bo Pang and Lillian Lee (2004)
  • Publication: "A Sentimental Education: Sentiment Analysis Using Subjectivity Summarization Based on Minimum Cuts", ACL 2004
  • Size: 2,000 movie reviews from IMDb
  • Balance: Perfectly balanced (1,000 positive, 1,000 negative)

Citation

@InProceedings{Pang+Lee:04a,
  author = {Bo Pang and Lillian Lee},
  title = {A Sentimental Education: Sentiment Analysis Using Subjectivity Summarization Based on Minimum Cuts},
  booktitle = "Proceedings of the ACL",
  year = 2004
}

๐Ÿ”ฎ Future Improvements

๐Ÿ“ˆ Immediate Enhancements

  • Adjust decision threshold based on domain-specific validation
  • Implement preprocessing to handle negations more effectively
  • Add movie-specific sentiment lexicon expansions
  • Consider sentence-level sentiment analysis for longer reviews

๐Ÿš€ Advanced Approaches

  • Implement transformer-based models (BERT, RoBERTa) for better context understanding
  • Use ensemble methods combining VADER with other sentiment approaches
  • Develop domain-specific models trained on movie review corpora
  • Apply attention mechanisms to identify key sentiment-bearing passages

Learning Outcomes

Technical Skills Developed

  • Sentiment Analysis: Understanding VADER lexicon-based approach
  • Data Preprocessing: Cleaning and preparing text data for analysis
  • Performance Evaluation: Using comprehensive classification metrics
  • Statistical Analysis: Conducting significance tests and error analysis
  • Data Visualization: Creating professional, publication-ready charts

Domain Knowledge Gained

  • NLP Challenges: Real-world complexities in sentiment analysis
  • Human Language: Understanding context and semantic nuances
  • Model Limitations: When rule-based systems fall short
  • Research Methods: Systematic evaluation and error analysis

๐Ÿค Contributing

Contributions are welcome! Here's how you can help improve this project:

๐Ÿ› ๏ธ Areas for Contribution

  • Add additional sentiment analysis methods for comparison
  • Implement deep learning approaches (BERT, RoBERTa)
  • Create interactive web interface for real-time analysis
  • Add more comprehensive error analysis categories
  • Improve documentation and add more examples

๐Ÿ“ How to Contribute

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ‘จโ€๐Ÿ’ป Author

Ahmad Hammam

Skills Demonstrated in This Project:

  • Advanced Python programming and data analysis
  • Natural Language Processing with NLTK
  • Statistical analysis and hypothesis testing
  • Professional data visualization and storytelling
  • Research methodology and systematic evaluation
  • Technical documentation and communication

๐Ÿ™ Acknowledgments

  • Cornell University for providing the movie review dataset
  • NLTK Team for the excellent VADER sentiment analysis tool
  • Open Source Community for making advanced NLP accessible to everyone

๐Ÿ“Š Project Stats


โญ If you found this project helpful, please consider giving it a star! โญ

๐ŸŽฌ "In the world of sentiment analysis, context is king and VADER is a worthy knight!" ๐ŸŽญ

About

Professional VADER sentiment analysis on IMDb movie reviews with comprehensive evaluation and error analysis (๐Ÿ“‰,๐Ÿ“ˆ)

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages