Kobby Panford-Quainoo, Michaël Defferrard
This repository contains all materials that accompanies our paper. Here we show how bilateral trade between countries can be framed as a problem of learning on graphs where we do classification of node (countries) into their various income levels (node classes). We also show that the likeliness of any two countries to trade can be predicted (link prediction). The data for our experiments were downloaded from https://comtrade.un.org.
-
Clone this repository.
$ git clone https://github.com/panford/BiTrade-Graphs.git $ cd BiTrade-Graphs -
Install dependencies. Dependencies can be installed using either the
requirements.txtorenvironments.ymlfiles. Follow any of the steps that follows to set up the environment.$ pip install -r requirements.txt
$ conda create -f environment.yml $ conda activate bitgraph_env
Check out the PyTorch Geometric installation guide for hints on how to set up PyTorch and PyTorch Geometric with the right version of cuda.
-
Enter the
Bitrade-Graph/codefolder.$ cd /path/to/BiTradeGraph/code -
Preprocess the data.
$ python process_data.py
This will create a
preprocessed.npyfile in thedata/processedfolder (or a path specified by--outdir). -
Run code for node classification and link prediction.
$ python run_classifier.py $ python run_linkpredictor.py
Results will be saved in the
resultsfolder.
Notebooks are included to show the followed steps from data preprocessing to their use in downstream tasks.
-
Start jupyter.
$ jupyter notebook
-
Navigate to the
notebooksfolder. -
First run all cells in the
preprocessing.ipynbnotebook to process data. Thentraining_nb.ipynb.
This project is licensed under the MIT License.