Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qdata/lamp
ECML 2019: Graph Neural Networks for Multi-Label Classification
https://github.com/qdata/lamp
computer-vision graph-attention-networks graph-neural-networks multi-label-classification nlp transformers
Last synced: 2 days ago
JSON representation
ECML 2019: Graph Neural Networks for Multi-Label Classification
- Host: GitHub
- URL: https://github.com/qdata/lamp
- Owner: QData
- License: mit
- Created: 2019-04-05T20:28:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-07-21T20:28:01.000Z (4 months ago)
- Last Synced: 2024-07-21T22:03:24.314Z (4 months ago)
- Topics: computer-vision, graph-attention-networks, graph-neural-networks, multi-label-classification, nlp, transformers
- Language: Python
- Homepage: https://arxiv.org/pdf/1904.08049.pdf
- Size: 441 KB
- Stars: 89
- Watchers: 7
- Forks: 18
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
**Graph Neural Networks for Multi-Label Classification**
Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi
ECML-PKDD 2019
[[paper]](https://arxiv.org/abs/1904.08049)
[[slides]](https://jacklanchantin.github.io/documents/LaMP_slides.pdf)
[[poster]](https://jacklanchantin.github.io/documents/LaMP_poster.pdf)This repository contains a PyTorch implementation of LaMP from [Neural Message Passing for Multi-Label Classification
](https://arxiv.org/abs/1904.08049) (Lanchantin, Sekhon, and Qi 2019)**Note**: see our updated model (C-Tran) for multi-label image classification at: [github.com/QData/C-Tran](https://github.com/QData/C-Tran)
## Overview
In this paper, we propose Label Message Passing (LaMP) Networks to model the joint
prediction of multiple labels by treating labels as nodes on a graph.
We use message passing neural networks (a generalization of graph neural networks) to implicitly model
the dependencies between labels conditioned on an input.## Requirement
- python 3.4+
- pytorch 0.2.0
- tqdm
- numpy## Usage
### Process The Data
Download the data from: [https://www.cs.virginia.edu/yanjun/jack/lamp_datasets.tar.gz](https://www.cs.virginia.edu/yanjun/jack/lamp_datasets.tar.gz) (745M)
```bash
wget https://www.cs.virginia.edu/yanjun/jack/lamp_datasets.tar.gz
```Untar into the current directory
```bash
tar -xvf lamp_datasets.tar.gz -C ./
```Note: the data directory provided includes preprocessed data. To use your own data, see utils/preprocess.py which includes an example how to run in the comments at the top.
### Train and Test the model (training script contains the validation and testing code)
```bash
python main.py -dataset reuters -batch_size 32 -d_model 512 -d_inner_hid 512 -n_layers_enc 2 -n_layers_dec 2 -n_head 4 -epoch 50 -dropout 0.2 -dec_dropout 0.2 -lr 0.0002 -encoder 'graph' -decoder 'graph' -label_mask 'prior'
```All datasets allow for the usage of the graph encoder (`-encoder 'graph'`) except for nuswide_vector, which requires the encoder argument to be set to 'mlp' (`-encoder 'mlp'`), since this is a vector input (see Appendix Table 5 of the paper for all data types).
To use the fully connected label graph, use `-label_mask none`, and to use the edgeless label graph, use `-label_mask inv_eye`.
The main.py file evaluates each epoch for all metrics using the default threshold. However, in order to get the final results, you need to find the optimal threshold for each metric on the validation set. We selected from the following thresholds:
[0.01,0.02,0.03,0.04,0.05,0.06,0.07,0.08,0.09,0.10,0.15,0.20,0.25,0.30,0.35,0.40,0.45,0.50,0.55,0.60,0.65,0.70,0.75,0.8,0.85,0.9,0.95]Feel free to open an issue with any questions.
## Acknowledgement
Much of this code was adapted from https://github.com/jadore801120/attention-is-all-you-need-pytorch