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.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
code
data
images
notebooks
results
tuned_results
.gitignore
Kobby_project.pdf
LICENSE.txt
README.md
environment.yml
requirements.txt

README.md

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 https://comtrade.un.org.

Installation

  1. Clone this repository.

    $ git clone https://github.com/panford/BiTrade-Graphs.git
    $ 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 process_data.py

    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 run_classifier.py
    $ python run_linkpredictor.py

    Results will be saved in the results folder.

Notebooks

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.

License

This project is licensed under the MIT License.

You can’t perform that action at this time.