Rethinking travel behavior modeling representations through embeddings

Francisco C. PereiraarXiv 2019

Abstract

This paper introduces the concept of travel behavior embeddings, a method for re-representing discrete variables typically used in travel demand modeling—such as mode, trip purpose, education level, family type, or occupation. This process maps categorical variables into a latent "embedding space," allowing for richer nuances than traditional transformations like dummy encoding or principal components analysis. This data-driven approach is informative, consistent, and preserves the interpretability of coefficients while remaining transferable across datasets. Inspired by Natural Language Processing (NLP) techniques like word2vec, the method is demonstrated using a mode choice model on the Swissmetro dataset. Results show improvements of up to 60% in initial likelihood and 20% in out-of-sample evaluation compared to traditional models. We also introduce PyTre (PYthon TRavel Embeddings), an open-source package for implementing these techniques.

Introduction

In travel behavior modeling, researchers frequently encounter categorical data such as origin-destination pairs, trip purposes, or socio-economic indicators. The standard approach to handling these variables is "dummy encoding" (one-hot encoding), which assigns a binary variable to each category.

However, dummy encoding suffers from two primary limitations. First is the dimensionality explosion: a high number of categories (e.g., 100 origin-destination pairs) results in a massive increase in parameters, leading to potential overfitting. Second is enforced orthogonality: dummy encoding assumes all categories are equidistant from one another. In reality, a "student" may exhibit travel behaviors more similar to an "unemployed" individual than a "retired" person. Traditional models fail to capture these intuitive semantic distances.

Methodological Framework

The proposed method adapts the word2vec architecture from NLP to travel data. In this framework, categorical variables are mapped into a lower-dimensional continuous latent space where semantically similar categories are positioned closer together.

The skip-gram neural network architecture used to generate categorical embeddings.

The architecture utilizes a shallow neural network consisting of:

  • Input Layer: A one-hot encoded vector representing the categorical variable.
  • Hidden Layer (The Embedding): A set of linear neurons that compress the input into a lower-dimensional space ($K << D$).
  • Output Layer: A softmax classifier that predicts the target choice (e.g., travel mode).

To prevent overfitting—a significant risk given that travel datasets are typically smaller than text corpora—the model incorporates a regularizer layer. This ensures the latent representation remains stable by penalizing the model if it cannot reconstruct the original category from the embedding.

Experimental Setup and Results

The method was validated using the Swissmetro dataset, a benchmark in transportation research containing 10,469 responses regarding a hypothetical mag-lev system. Variables such as age, income, and ticket types were encoded using the embedding approach.

Performance and Efficiency

The embedding-based model demonstrated superior performance and stability compared to traditional methods:

  • Accuracy: The method achieved up to a 60% improvement in initial likelihood and a 20% improvement in out-of-sample log-likelihood over dummy variable models.
  • Parsimony: The embedding model required only 39 parameters to outperform a dummy model using 232 parameters. While the dummy model showed signs of severe overfitting, the embedding model remained robust.

Semantic Interpretability and Algebra

By projecting the latent space using Multi-dimensional scaling (MDS), the researchers found that the embeddings were highly interpretable. Categories with similar behavioral impacts naturally clustered together. Furthermore, the embeddings exhibit algebraic properties similar to those found in NLP.

Examples of vector algebra in embedding spaces, demonstrating semantic relationships.

Just as NLP embeddings allow for analogies like "King - Man + Woman = Queen," travel embeddings potentially allow for "behavioral algebra," where the spatial relationships between categories represent logical behavioral shifts.

Conclusion and Future Work

Travel behavior embeddings offer a powerful, data-driven alternative to traditional categorical encoding. They preserve interpretability while significantly enhancing model performance and parameter efficiency.

Future research will focus on integrating these embeddings into more complex structures like Nested Logit or Latent Class Choice Models. Additionally, the transferability of these embeddings across different cultural and geographic contexts remains a key area for exploration, potentially allowing the research community to share "pre-trained" behavioral nuances across global datasets.

Summary updated

BibTeX
@misc{pereira2019rethinking,
  author = {Francisco C. Pereira},
  title = {{Rethinking travel behavior modeling representations through embeddings}},
  year = {2019},
  eprint = {1909.00154},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1909.00154},
}
Figure