Code accompanying paper
@inproceedings{Schwarzenberg_lrv_2019,
title = {Layerwise Relevance Visualization in Convolutional Text Graph Classifiers},
booktitle = {Proceedings of the EMNLP 2019 Workshop on Graph-Based Natural Language Processing},
author = {Schwarzenberg, Robert and Hübner, Marc and Harbecke, David and Alt, Christoph and Hennig, Leonhard},
location = {Hong Kong, China},
year = {2019}
}
Apply LRP to GCNs. Visualize relevance in each layer.
- Create environment w/ python 3.6, e.g.
conda create --name research-xgcn python=3.6
source activate research-xgcn
- Install requirements.txt, e.g.
pip install -r requirements.txt
- Install English scispacy language model
pip install https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.2.0/en_core_sci_sm-0.2.0.tar.gz
- Download (last accessed 2019-05-16)
https://dl.fbaipublicfiles.com/fasttext/vectors-english/wiki-news-300d-1M.vec.zip
and extract
wiki-news-300d-1M.vec
into
./data/embeddings/
The input data is contained in
./data/PubMed_20k_RCT/
It was downloaded on 2019-05-16 from
https://github.com/Franck-Dernoncourt/pubmed-rct
-
Check config.json, to run the full pipeline, all values in the pipeline namespace should be true.
-
Run main.py which runs
- preprocess.py (prepares dictionary, input data)
- train.py (train XGCN)
- explain.py (LRV on the trained XGCN, writes explanations to json lines)
- postprocess.py (summarizes occlusion experiments in plots, writes latex document)
-
run pdflatex on data/explanations/explanations.tex (make sure tiks-dependency is installed)
-
View the explanations in ./data/explanations/explanations.pdf (if config was not changed)