Multi-Scale Representation Learning for Spatial Feature Distributions using Grid Cells

Gengchen Mai, Krzysztof Janowicz, Bo Yan, Rui Zhu, Ling Cai, Ni Lao

Introduction

Space2Vec is a novel representation learning model designed to encode geographic coordinates into high-dimensional vectors using multi-scale periodic functions. Inspired by the "grid cells" found in mammalian brains, this approach allows machine learning models to handle spatial data across vastly different scales—from dense urban clusters to sparse rural distributions. By doing so, it significantly outperforms traditional spatial encoding methods like Radial Basis Function (RBF) kernels and tile-based discretization.

The Challenge of Spatial Scale

In Natural Language Processing, powerful tools like Word2Vec or BERT are used to turn discrete words into meaningful, context-aware vectors. In spatial analysis, however, researchers often treat coordinates ($x, y$) as raw numbers or simply chop the map into a fixed grid of tiles.

The authors identify a major "scale" problem with these traditional approaches: geographic features do not distribute themselves uniformly. For example, "Women's Clothing" stores might be tightly clustered in a downtown mall, while "Education" facilities like schools are spread out much more evenly across a city.

Spatial distributions of different POI types, showing clustered (Women's Clothing) versus dispersed (Education) patterns.

A model using a large grid size will miss the fine-grained nuances of the clustered clothing stores (underfitting), while a model using a tiny grid size will struggle to generalize for the widely dispersed schools (overfitting). Existing methods usually operate at a single scale and fail to capture these "mixtures of distributions" simultaneously.

Methodology: The Space2Vec Framework

To solve this, the authors propose Space2Vec, an encoder-decoder framework designed to learn a general-purpose representation of space.

The Encoder

Instead of feeding raw coordinates directly into a network, Space2Vec uses a series of sine and cosine functions at different frequencies to create a multi-scale periodic representation.

  • The theory model is mathematically grounded in neuroscience research on hexagonal grid cells, utilizing three sets of cosine gratings oriented at 60° to each other.
  • The grid model is a simpler variant inspired by the positional encoding mechanisms used in Transformer architectures.

The Decoders

The framework employs two types of decoders depending on the task:

  1. Location Decoder: Predicts the characteristics of a place (e.g., Point of Interest type) based solely on its encoded absolute location.
  2. Spatial Context Decoder: Uses a multi-head attention mechanism to predict a point's features based on its neighbors, explicitly modeling the spatial relationships (distance and direction) between them.

Crucially, the model can be trained via unsupervised learning. Similar to how Word2Vec learns from surrounding words, Space2Vec maximizes the likelihood that a specific Point of Interest (POI) exists at a given location relative to its surrounding spatial context.

Experimental Setup and Datasets

The researchers evaluated Space2Vec across two distinct domains:

  1. POI Prediction (Yelp Data): A dataset of 21,830 POIs in downtown Las Vegas, categorized into 1,191 types. This tested how well the model predicts POI types based on location and context.
  2. Fine-Grained Image Classification: Using two large-scale datasets (BirdSnap and NABirds), the goal was to use the geographic location where a photo was taken as a "prior" to help a computer vision model distinguish between visually similar bird species that inhabit different regions.

Key Insights and Results

  • Bio-Inspiration Works: By mimicking the multi-scale periodic firing pattern of mammalian grid cells, Space2Vec naturally gains a "metric" for space that simple feed-forward neural networks lack. Visualizations of the model's hidden layers reveal "response maps" that remarkably resemble the hexagonal grids found in biological brains.
  • Scale Independence: Because the encoder concatenates many different frequencies (ranging from 50 meters to 40 kilometers), the model doesn't have to "choose" a single resolution. It effectively sees both the "forest" and the "trees."
  • Inductive Generalization: Unlike RBF kernels, which are transductive and need to remember training points, Space2Vec is inductive. Once trained, it can encode any coordinate on Earth into a vector without referencing the original training set.
  • Superior POI Prediction: In the Las Vegas dataset, the Space2Vec theory version achieved a Mean Reciprocal Rank (MRR) of 0.144, significantly outperforming the standard tile approach (0.120) and rbf kernels (0.123). It was the only model to perform consistently well across "Clustered," "Middle," and "Even" distribution extremes.
  • Boosting Computer Vision: On the NABirds dataset, adding a Space2Vec spatial prior to an InceptionV3 image classifier boosted accuracy from 76.08% to 81.59%, establishing a new state-of-the-art for geographic prior methods.

Limitations and Future Directions

While Space2Vec is highly effective, the authors note that its relative performance gains are smaller when spatial context information is already exceptionally rich, as the model then relies more on nearby POIs than the absolute coordinate encoding.

Currently, the image classification application uses "late fusion" (combining predictions at the very end of the pipeline). The authors suggest that "early fusion"—integrating spatial embeddings directly into the neural network's earlier hidden layers—could yield even better results. Future work will also explore applying Space2Vec to more complex GIS tasks, such as social network analysis, urban planning, and environmental monitoring.

Summary updated

Abstract

Unsupervised text encoding models have recently fueled substantial progress in NLP. The key idea is to use neural networks to convert words in texts to vector space representations (embeddings) based on word positions in a sentence and their contexts, which are suitable for end-to-end training of downstream tasks. We see a strikingly similar situation in spatial analysis, which focuses on incorporating both absolute positions and spatial contexts of geographic objects such as POIs into models. A general-purpose representation model for space is valuable for a multitude of tasks. However, no such general model exists to date beyond simply applying discretization or feed-forward nets to coordinates, and little effort has been put into jointly modeling distributions with vastly different characteristics, which commonly emerges from GIS data. Meanwhile, Nobel Prize-winning Neuroscience research shows that grid cells in mammals provide a multi-scale periodic representation that functions as a metric for location encoding and is critical for recognizing places and for path-integration. Therefore, we propose a representation learning model called Space2Vec to encode the absolute positions and spatial relationships of places. We conduct experiments on two real-world geographic data for two different tasks: 1) predicting types of POIs given their positions and context, 2) image classification leveraging their geo-locations. Results show that because of its multi-scale representations, Space2Vec outperforms well-established ML approaches such as RBF kernels, multi-layer feed-forward nets, and tile embedding approaches for location modeling and image classification tasks. Detailed analysis shows that all baselines can at most well handle distribution at one scale but show poor performances in other scales. In contrast, Space2Vec ’s multi-scale representation can handle distributions at different scales.
BibTeX
@inproceedings{mai2020multi,
  author = {Gengchen Mai and Krzysztof Janowicz and Bo Yan and Rui Zhu and Ling Cai and Ni Lao},
  title = {{Multi-Scale Representation Learning for Spatial Feature Distributions using Grid Cells}},
  booktitle = {International Conference on Learning Representations},
  year = {2020},
  url = {https://openreview.net/forum?id=58Fac0lsUJ},
}
Figure