Skip to content

jw7383/Rationalizing-Neural-Predictions-Replication-and-Extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rationalizing Neural Predictions Replication and Extension

This is the GitHub repository is for the Course Project of DS-GA 1011 Natural Language Processing Final Project (2022) at New York University. Topics include: NLP, Sentiment Prediction, and Rationale Analysis, and Interpretability

Authors: Jason Wang, Xu Han, and Chloe Zheng

This repo replicates the Beer Advocate experiment as described in this paper.

Acknowledgements for this code include the original paper's source code and Adam Yala's PyTorch implemention.

To run the model, first you need to obtain the Beer Advocate review data by going here.

  1. Download the data, which are the files reviews.aspect{#}.{dataset}.txt.gz, to "raw_data/beer_advocate/data".

  2. Download the embeddings, which is the file review+wiki.filtered.200.txt.gz, to "raw_data/beer_advocate/embeddings".

Then run the model using an example command like so:

python -m main --train --test --get_rationales --aspect appearance --epochs 1 --cuda --num_workers 1 --debug_mode

Use --get_rationales to enable extractive rationales.

The results and extracted rationales will be saved in "results_path/args_dict.pkl" and be accessed as

results = pickle.load(open('results_path/args_dict.pkl','rb'))
rationales = results['test_stats']['rationales']

extracted_rationales.ipynb provides an example on a model that was trained with --debug_mode and 10 epochs.

About

DS-GA 1011: Natural Language Processing Final Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published