Matrix Factorization for Near Real-time Geolocation Prediction in Twitter Stream

Nghia Duong-Trung, Nicolas Schilling, Lucas Drumond, Lars Schmidt-Thieme

Abstract

Predicting the geographical origin of social media content is essential for real-time applications such as disaster management and disease surveillance. However, traditional geolocation methods often rely on aggregating a user's historical data, which is unsuitable for real-time streaming contexts. This paper presents Geo Matrix Factorization (GMF), a model designed to predict precise latitude and longitude from a single tweet. By mapping sparse text into a dense latent feature space and applying regression, GMF overcomes the limitations of high-dimensional text data and the boundary issues inherent in classification-based approaches.

Introduction

Geolocation—the process of determining the physical coordinates of a message—has become a cornerstone of location-aware services. While metadata (like GPS tags) provides high accuracy, it is available for only a small fraction of the Twitter stream. Consequently, researchers have turned to text-based prediction.

Existing literature faces two primary challenges. First, most models require a large corpus of tweets from a single user to build a profile, failing in "near real-time" scenarios where an immediate location is needed for a single post. Second, many models treat the world as a discrete grid, turning geolocation into a classification problem. This discretization discards the continuous nature of geography and introduces errors at grid boundaries. This paper introduces GMF to address these hurdles through a regression-based approach on latent text representations.

Methodology

Geo Matrix Factorization (GMF)

The core of the GMF approach is the transformation of sparse, high-dimensional tweet data into a lower-dimensional "concept" space. A single tweet, often limited to 140 characters, contains very few active features (words) relative to the total vocabulary, making standard regression models prone to noise.

  1. Dimensionality Reduction: GMF utilizes Matrix Factorization ($X \approx TW$) to decompose the tweet-word matrix ($X$) into a latent tweet representation ($T$) and a latent word representation ($W$). This process effectively denoises the text by identifying underlying thematic structures.
  2. Latent Space Regression: Rather than predicting coordinates from raw word counts, the model employs a linear combination of the latent features in $T$ to estimate latitude and longitude.
  3. User Bias Integration: To improve accuracy for known users, the model incorporates the user’s average training location as a baseline. The regression term then acts as a "correction" based on the specific content of the current tweet.
  4. Inference via Fold-in: For real-time prediction of unseen tweets, GMF uses a "fold-in" procedure. The learned word weights ($W$) remain fixed, and the model identifies the optimal latent representation ($T$) for the new tweet before passing it to the regression layer.

Optimization

The model is optimized using Stochastic Gradient Descent (SGD). To manage the scale and sparsity of Twitter data, the authors implemented the AdaGRAD learning rate adapter, ensuring robust convergence across diverse feature frequencies.

Experimental Setup

Datasets

The GMF model was evaluated across three datasets of varying scales:

  • US: 377,616 tweets from 9,475 users within the United States.
  • NA (North America): 226,595 tweets from 10,950 users.
  • WORLD: 121,327 tweets from 80,179 users globally.

Evaluation Protocols

The researchers utilized two splitting strategies:

  • LocalRandom (LR): Tweets from the same user appear in both training and testing sets, testing the model's ability to learn user-specific patterns.
  • GlobalRandom (GR): Test sets contain users entirely absent from the training data, testing the model's ability to generalize based solely on linguistic cues.

Results and Discussion

GMF demonstrated significant improvements over baseline models, including Support Vector Machines (SVM) and Factorization Machines (FM).

In the US dataset under the LocalRandom protocol, GMF achieved a median error of 0.66 km, a substantial improvement over SVM (7.81 km). Even on the WORLD dataset—characterized by extreme sparsity (average of 5 tokens per tweet)—GMF maintained a median error of 553 km, whereas competing models exceeded 2,650 km.

These results highlight several key insights:

  • Sparsity Mitigation: Matrix factorization successfully extracts geographical signals from latent themes, which is more robust than relying on specific, rare keywords.
  • Continuous Prediction: By utilizing regression over classification, GMF avoids the "boundary problem" and provides more granular coordinate predictions.
  • Efficiency: By reducing the feature space to a small number of latent dimensions (e.g., 8), the model remains computationally efficient enough for high-throughput streaming data.

Conclusion

GMF provides a powerful framework for real-time geolocation by treating the problem as a regression task in a latent feature space. While the current model optimizes for Mean Squared Error (MSE) on coordinates, future iterations could benefit from directly optimizing for Haversine distance (great-circle distance). Additionally, while this study focused strictly on text to prove the model's efficacy, integrating metadata such as timestamps or user profiles would likely further enhance precision in production environments.

Summary updated

BibTeX
@inproceedings{duongtrung2016matrix,
  author = {Nghia Duong-Trung and Nicolas Schilling and Lucas Drumond and Lars Schmidt-Thieme},
  title = {{Matrix Factorization for Near Real-time Geolocation Prediction in Twitter Stream}},
  booktitle = {LWDA},
  year = {2016},
}
Figure