This repository contains the code to replicate the results reported in our AAAI 2022 paper: Bag Graph: Multiple Instance Learning using Bayesian Graph Neural Networks.
Antonios Valkanas & Soumyasundar Pal (equal first authors), Florence Regol, Mark Coates (Prof. McGill University)
Install the dependencies from the command line with pip
:
pip install -r requirements.txt --progress-bar off
Note: When the datasets are small enough we include them in the repository, otherwise we point to the original source where they can be downloaded. We provide all pre-processing code and the plotting code for the diagrams in the paper. Google Drive secondary repo with full datasets for experiments 1, 2, 4.
All our experiments occupy separate folders. To run a specific experiment go to the appropriate directory and follow the instructions below. Unless otherwise specified, the datasets are included in the experiment subfolders.
We perform classification experiments on 5 benchmark MIL datasets, 20 text datasets from the 20 Newsgroups corpus, and the 2016 US election data. In addition, we also consider a distribution regression task of predicting neighborhood property rental prices in New York City.
Go to mil_benchamark
folder and run:
python run_trials.py
Navigate to mil_text
folder and run:
python run_trials.py
To get the data go to the source repository and download centroids_cartesian_10.csv
and results-2016-election.csv
. Create a data
subdirectory and copy these files there.
Continue by downloading the set_features
and cleaned_set_features
subdirectories from our drive link and saving them under the same data
directory.
In mil_election_classification
folder run:
python run_trials.py
After the runs have completed you can get the figure from the paper by running:
python visualization.py
You should get the following figure (top 2 methods are baselines, bottom left is ours, bottom right is ground truth):
Locate mil_rental_data
folder and run:
python deepset_main.py # runs DeepSet backbone trials
python set_transformer_main.py # runs Set Transformer backbone trials
python evaluate.py # statistical significance tests
Please cite our paper if you use this code in your own work:
@inproceedings{pal_valkanas2022,
author={S. Pal and A. Valkanas and F. Regol and M. Coates},
title = {Bag graph: {M}ultiple instance learning using {B}ayesian graph neural networks},
booktitle={Proc. AAAI Conf. Artificial Intell.},
month = {Feb.},
year = {2022},
address = {Online Conference}
}