Project · AI & ML

Airport Classification by Country

A graph neural network that guesses an airport's country from its position, its city's population and its air routes.

Ref.
01.03
Period
Oct 2024
Status
Completed
Organization
M2 AI — UCBL
Stack
  • Python
  • PyTorch
  • PyTorch Geometric
  • scikit-learn

Key points

  1. Airports as nodes, air routes as edges, a 3-layer GCN predicting each airport's country.
  2. Tested the effect of class count, node features, route weights and graph structure.
  3. Final model: 24 countries, 89.1 % on the test set.

The question

Can a network guess which country an airport belongs to, only from where it is and where its flights go? This was my project for the Bio-Inspired Machine Learning course, taught by Rémy Cazabet, done alone.

The data is a graph provided by the course: every airport is a node, every air route an edge. Each airport comes with its latitude, longitude, country and the population of its city (Fig. 1).

My hypothesis: the city's population, added to the coordinates, should help tell neighbouring countries apart.

Fig. 1The goal: every airport, coloured by its country.
World map made of airport dots, one colour per country: dense clusters in the United States, Europe and Australia, sparse dots across Africa and Siberia

Fig. 1The goal: every airport, coloured by its country.

The model

A graph convolutional network (GCN) in PyTorch Geometric: three graph convolution layers with ReLU, then a log-softmax over the countries. Each layer mixes an airport's features with those of the airports it is linked to, so the routes carry information from one airport to the next (Fig. 2).

The inputs are latitude, longitude and population, standardised. The airports are split 80 / 10 / 10 into training, validation and test sets, and the score is the accuracy on the test airports.

Fig. 2The model: three graph convolutions over the route network, then one score per country.
An airport node with latitude, longitude and population, linked by air routes to neighbouring airports, thicker lines for closer ones; it goes through three graph convolution layers, the first two followed by ReLU, then a log-softmax giving one score per country

Fig. 2The model: three graph convolutions over the route network, then one score per country.

What changes the result

I varied one thing at a time.

How many countries. With every country kept, there are 212 classes, many with a single airport the model never sees in training: 61 % accuracy. Keeping only the countries with at least N airports shrinks the problem, and the accuracy climbs above 93 % from 12 countries down (Fig. 3).

The remaining errors mostly fall between neighbouring countries.

Fig. 3Fewer, bigger countries: higher accuracy.
Test accuracy against the minimum number of airports per country: 61 % with all 212 countries, 75 % at 67 countries, 88 % at 24 countries, above 93 % with 12 countries or fewer

Fig. 3Fewer, bigger countries: higher accuracy.

Which features. Population does help, a little, on top of the coordinates (Table 1). On its own it is nearly useless with many countries, but with only four left it reaches 78 %, probably enough to separate, for example, the United States from Canada.

Weighting the routes. Giving each route a weight that grows as the two airports get closer helped at every scale, the most with many countries: from 64 % to 70 %.

Inputsmin 10 · 67 countriesmin 50 · 12 countriesmin 100 · 4 countries
Latitude, longitude64.192.795.9
+ population67.194.998.4
Latitude, longitude, routes weighted by distance70.293.897.5
Population only10.517.577.7
Table 1Test accuracy (%) by input features, for three minimum numbers of airports per country (best in bold).

The graph itself. Two other graphs show how much the edges matter. Linking every airport to every other drops the accuracy to 55 % with only four countries: too many links drown the signal. Linking each airport only to the airports of its own country gives a near-perfect score, but that graph already contains the answer, so it is a check rather than a real model.

The final model

Coordinates and population, routes weighted by distance, countries with at least 30 airports: 24 countries. Trained for 3,153 epochs at a learning rate of 0.001, it reaches 95 % on the training set, 91.4 % on validation and 89.1 % on the test set. Most countries come out clean on the map (Fig. 4); the mistakes sit near borders, where a route network and a position do not say much about which side an airport is on.

Fig. 4The final model's predictions for the 24 countries kept.
World map of the airports of the 24 countries kept, coloured by the predicted country; the clusters match the countries, with a few stray dots near borders such as between the United States and Canada

Fig. 4The final model's predictions for the 24 countries kept.

References

  1. [1]Kipf, Welling (2017). Semi-Supervised Classification with Graph Convolutional Networks. ICLR
  2. [2]Fey, Lenssen (2019). Fast Graph Representation Learning with PyTorch Geometric. ICLR Workshop
#gnn#graphs#geospatial#classification