Title: Document Classification using Hierarchical Attention Networks
Author:
- Vinayak Sengupta (vs4016@rit.edu)
About:
In this repository, we use 50,000 IMDb movie reviews, specially selected for sentiment analysis, as well as implement an newly-adapted and improved version of a Paper, written by Yang et al. from the 2016 NAACL called Hierarchical Attention Networks for tackling Document Classification.
- Document_Classifier.ipynb (Models Folder) - This notebook contains, the actual modelling of the Hierarchial Attention Network, it then takes in the data (avalialble in the data folder) and utilisng the model classifies sentences in the document and assigns attention values (more attention = sentence is important for classification of the document, less attention = sentence is not very important for classification of the document).
- Sentence_Classifier.ipynb (Models Folder) - This notebook contains, the actual modelling of the Hierarchial Attention Network, it then takes in the data (avalialble in the data folder) and utilisng the model classifies words in the sentences of the document and assigns attention values (more attention = sentence is important for classification of the sentence and ultimately the document, less attention = sentence is not very important for classification of the sentence and ultimately the document).
- Data Folder - The folder consists of the raw data set used.
- NLP_Project_Report - PDF file consisting of a comprehensive writeup of the entire project implementation and also comparison to the paper to which this algorithm is compared to.
- Python 3
- numpy
- pandas
- BeautifulSoup
- Matplotlib
- tensorflow
- keras
- (optional) CUDA cores
- Clone the project
- Check if all library/package dependancies are fulfilled, if not install them.
- The project does not use too many external dependancies hence, you only need to install them using the command
!pip install (package_name)in jupyter notebook cell, just before importing them.
- The project does not use too many external dependancies hence, you only need to install them using the command
- Make sure you have the data as well downloaded.
- Then just run both the files and everything should work fine.
If there are any issues, please do reach out to me
An analysis of 50,000 IMDB movie reviews was conducted for the labeled data set. Reviews are scored as binary sentiment, so a 5-star IMDB rating results in a score of 0, and a rating >=7 results in a score of 1. The sentiment of reviews is derived from what is written about each movie. It does not contain any movies that are part of the test set with 25,000 reviews. Furthermore, IMDB reviews without labels are available for another 50,000 titles.
- Hierarchical Attention Network for Sentence Classification
- Hierarchical Attention Network for Word Classification
- Hierarchical Attention Network for Document Classification
- Document Classification
- Hierarchical Attention Network for Sentence Classification
- Sentence Classification
| Author | Model | Data Set | Accuracy |
|---|---|---|---|
| Yang et al. | HN-ATT | IMDB | 49.4 |
| Vinayak (me) | HN-GRU (Document) | IMDB | 88.4 |
| Vinayak (me) | HN-GRU (Sentence) | IMDB | 84.4 |





