This repository contains code for paper https://arxiv.org/abs/2010.04736 appearing in EMNLP2020.
pip install -r requirements.txt
config:dictates the experimentation scriptdata_configset the output directory for the experimentationdata_configset the appropriate input directories for all the datasetsmodel_configselect amongroberta,lstm,random forestor/andlogistic regressionclassifierdata_configselect amongwikiattack,sst,movie,multirc,feveror/andesnlidatasets
dataset:Dataset class with super classtorch.utils.data.Datasetto create dataloaders and datasets for trainerfidelity:compute fidelity given predictions or model and input ids (change the code to usenlp fidelity)model:contains classifiers for experimentationlstm_classifiertext --> RoBERTa embedding --> BiLSTM --> Linearroberta_classifierrobertaForSequenceClassificationsklearn_classifiertext --> sklearnTokenizer --> sklearnVectoriser --> sklearnClassifier(random forest or logistic regression)
plotting: dataset_and_fidelity_analysis_plotscontains the plotting code for all figurespreliminary_analysis: analyze_datasets and generate_tableto analyze all the datasets for mean text length, mean rationale length.scripts: run_experiment_trainer and run_experiment_sklearnto run experiment on roberta classifier, lstm classifier and sklearn classifier respectively.train_eval:contains the code for generating data for fidelity curves and to cache prediction to generate plotsutil:some utility functions
RoBERTA classifierhidden_dropout_prob
LSTM classifierhidden_sizepad_packing
Random Forest classifiern_estimators
Logistic Regression classifierC
Training Paramslearning_ratenum_train_epochsweight_decaybatch_size
- Add the location of the output directory in the config
- Add the location of the corresponding data directories in the config
- Choose the model and the data on which analysis is to be performed
- Run the experiment using
run_experiment_trainer.pyorrun_experiment_sklearn.pyif the model is lstm or roberta and logistic regression or random forest respectively.
@inproceedings{carton+rathore+tan:20,
author = {Samuel Carton and Anirudh Rathore and Chenhao Tan},
title = {Evaluating and Characterizing Human Rationales},
year = {2020},
booktitle = {Proceedings of EMNLP}
}