Skip to content
A graph-based approach to modelling bilateral trade between countries
Jupyter Notebook Python
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

Bilateral Trade Modelling with Graph Neural Networks

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


  1. Clone this repository.

    $ git clone
    $ cd BiTrade-Graphs
  2. Install dependencies. Dependencies can be installed using either the requirements.txt or environments.yml files. 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.

Running our experiments

  1. Enter the Bitrade-Graph/code folder.

    $ cd /path/to/BiTradeGraph/code
  2. Preprocess the data.

    $ python

    This will create a preprocessed.npy file in the data/processed folder (or a path specified by --outdir).

  3. Run code for node classification and link prediction.

    $ python
    $ python

    Results will be saved in the results folder.


Notebooks are included to show the followed steps from data preprocessing to their use in downstream tasks.

  1. Start jupyter.

    $ jupyter notebook
  2. Navigate to the notebooks folder.

  3. First run all cells in the preprocessing.ipynb notebook to process data. Then training_nb.ipynb.


This project is licensed under the MIT License.

You can’t perform that action at this time.