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
- Airports as nodes, air routes as edges, a 3-layer GCN predicting each airport's country.
- Tested the effect of class count, node features, route weights and graph structure.
- 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.
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.
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.
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 %.
| Inputs | min 10 · 67 countries | min 50 · 12 countries | min 100 · 4 countries |
|---|---|---|---|
| Latitude, longitude | 64.1 | 92.7 | 95.9 |
| + population | 67.1 | 94.9 | 98.4 |
| Latitude, longitude, routes weighted by distance | 70.2 | 93.8 | 97.5 |
| Population only | 10.5 | 17.5 | 77.7 |
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.
References
- [1]Kipf, Welling (2017). Semi-Supervised Classification with Graph Convolutional Networks. ICLR
- [2]Fey, Lenssen (2019). Fast Graph Representation Learning with PyTorch Geometric. ICLR Workshop