Skip to content

A graph-based approach to modelling bilateral trade between countries

License

Notifications You must be signed in to change notification settings

panford/BiTrade-Graphs

Repository files navigation

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.

About

A graph-based approach to modelling bilateral trade between countries

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published