Source-linked AI summary

Self-supervised Trajectory Representation Learning with Temporal Regularities and Travel Semantics

Jiawei Jiang, Dayan Pan, Houxing Ren, Xiaohan Jiang, Chao Li, Jingyuan Wang

arXiv:2211.09510v4cs.LG

TL;DR

Trajectory representation learning often underuses travel semantics and temporal regularities, limiting how fully representations capture spatial-temporal trajectories. START combines travel-aware graph learning, time-aware trajectory encoding, and two trajectory-specific self-supervised tasks; experiments report superior performance, data-efficient supervision, and transfer across heterogeneous cities.

  • Problem

    Existing TRL methods do not fully exploit travel semantics and temporal regularities, although generic trajectory representations support multiple downstream tasks.

  • Method

    START uses TPE-GAT for travel-aware road representations, TAT-Enc for temporal trajectory encoding, and span-masked recovery plus trajectory contrastive learning for self-supervision.

  • Results

    Experiments on two large-scale datasets and three downstream tasks report superior performance versus state-of-the-art baselines, with transfer across heterogeneous trajectory datasets.

  • Takeaways & Limitations

    The framework can use fewer data to outperform a supervised model and can be transferred across heterogeneous trajectory datasets.

Abstract

from arXiv · show

Trajectory Representation Learning (TRL) is a powerful tool for spatial-temporal data analysis and management. TRL aims to convert complicated raw trajectories into low-dimensional representation vectors, which can be applied to various downstream tasks, such as trajectory classification, clustering, and similarity computation. Existing TRL works usually treat trajectories as ordinary sequence data, while some important spatial-temporal characteristics, such as temporal regularities and travel semantics, are not fully exploited. To fill this gap, we propose a novel Self-supervised trajectory representation learning framework with TemporAl Regularities and Travel semantics, namely START. The proposed method consists of two stages. The first stage is a Trajectory Pattern-Enhanced Graph Attention Network (TPE-GAT), which converts the road network features and travel semantics into representation vectors of road segments. The second stage is a Time-Aware Trajectory Encoder (TAT-Enc), which encodes representation vectors of road segments in the same trajectory as a trajectory representation vector, meanwhile incorporating temporal regularities with the trajectory representation. Moreover, we also design two self-supervised tasks, i.e., span-masked trajectory recovery and trajectory contrastive learning, to introduce spatial-temporal characteristics of trajectories into the training process of our START framework. The effectiveness of the proposed method is verified by extensive experiments on two large-scale real-world datasets for three downstream tasks. The experiments also demonstrate that our method can be transferred across different cities to adapt heterogeneous trajectory datasets.

I. INTRODUCTION

START addresses limitations of trajectory representation learning by incorporating travel semantics, temporal regularities, and trajectory-specific self-supervision. Its contributions include a two-stage framework and evidence of strong, data-efficient, transferable performance.

  • Motivation: START targets TRL methods that treat trajectories as ordinary sequences and omit important spatial-temporal information such as travel semantics and temporal regularities.Prior approaches include sequence-to-sequence reconstruction and two-stage methods based mainly on static road-network representations.
  • Framework: The framework uses two stages: TPE-GAT learns road representations from network information and travel semantics, while TAT-Enc incorporates temporal regularities into trajectory representations.The temporal encoder handles periodic patterns and irregular time intervals.
  • Self-supervision: Two self-supervised tasks—span-masked trajectory recovery and trajectory contrastive learning—model local order and spatial-temporal characteristics during training.The contrastive task uses trajectory-aware augmentations rather than generic sequence-learning objectives.
  • Findings: Experiments show that the proposed tasks can use fewer data to outperform a supervised model, and the method transfers across heterogeneous road-network datasets.The transferability is presented as useful when real-world applications have insufficient data.

B. Problem Statement

The TRL problem is to learn generic low-dimensional trajectory vectors for multiple downstream tasks while capturing both road-network structure and travel behavior. START addresses this by combining graph attention with trajectory-derived transfer probabilities and producing road representations that encode both sources of information.

  • Problem Statement: TRL learns a generic d-dimensional representation for each trajectory that can support travel-time estimation, classification, and similarity computation.The study focuses on road-network-constrained trajectories obtained by map matching raw GPS trajectories.
  • Trajectory Pattern-Enhanced Graph Attention Layer: The layer learns road representations from road features and network structure rather than relying only on random-walk encodings of static networks.The stated road features include road type, length, lanes, maximum speed, and network indegrees and out-degrees.
  • Trajectory Pattern-Enhanced Graph Attention Layer: TPE-GAT extends graph attention by introducing a historical transfer-probability matrix between roads to model road-visiting frequencies.This lets attention reflect both directed network connectivity and human mobility patterns.
  • Trajectory Pattern-Enhanced Graph Attention Layer: TPE-GAT is the first stage of START and converts the road network into road-segment representations while incorporating trajectory travel semantics.Its output represents each road with network context and trajectory-derived semantics.

B. Time-Aware Trajectory Encoder Layer

TAT-Enc is START’s second stage, converting road-representation sequences into trajectory representations while incorporating both periodic temporal patterns and irregular intervals between roads.

  • Time-Aware Trajectory Encoder Layer: TAT-Enc extends a Transformer encoder with temporal modules for periodic urban-traffic patterns and irregular time intervals.It contains a Trajectory Time Pattern Extraction module and a Time Interval-Aware Self-Attention module.
  • Time-Aware Trajectory Encoder Layer: The encoder models road co-occurrence through bidirectional contextual interaction and explicitly represents the varying intervals between road visits.These design choices convert road-level vectors into a trajectory-level representation while incorporating temporal regularities.

1) Trajectory Time Pattern Extraction Module:

The trajectory encoder fuses road, periodic-time, and positional embeddings, then uses interval-aware self-attention to make interactions depend on the timing between road visits. A learned placeholder representation summarizes the complete trajectory.

  • Trajectory Time Pattern Extraction Module: The trajectory input combines each road representation with minute, day-of-week, and positional embeddings before Transformer encoding.Minute indexes range from 1 to 1440 and day-of-week indexes from 1 to 7.
  • Time Interval-aware Self-attention Module: Time Interval-Aware Self-Attention replaces standard self-attention so road interactions reflect irregular temporal gaps.The adaptive interval matrix assigns larger impact to roads with shorter time intervals and smaller impact as intervals increase.
  • Time Interval-aware Self-attention Module: The adaptive interval matrix is derived from pairwise timestamp differences and transformed with a decay function before entering attention.The raw interval is δ_i,j = |t_i − t_j|, followed by δ′_i,j = 1/log(e + δ_i,j).
  • Trajectory Representation: After stacked self-attention layers, a placeholder inserted at the first position supplies the final d-dimensional trajectory representation.The resulting sequence representation is Z ∈ R^|T|×d, while the extracted trajectory vector is p_i ∈ R^d.

3) Trajectory Representation Pooling:

The framework uses span-masked trajectory recovery to learn spatial-temporal trajectory representations from consecutive masked road subsequences.

  • 3) Trajectory Representation Pooling:: Span masking selects consecutive trajectory subsequences rather than independently masking roads, reducing easy inference from neighboring roads.Masked roads and their minute and day-of-week indices are replaced with special tokens before encoding.
  • 3) Trajectory Representation Pooling:: The masked-road predictions are trained with cross-entropy, averaging losses over masked roads and trajectories in each mini-batch.M denotes the masked-road set, and the resulting averaged objective is Lmask.

2) Trajectory Contrastive Learning:

Trajectory contrastive learning complements mask prediction by constructing spatial-temporal views and optimizing representations so augmented positive trajectories are closer than negatives.

  • 2) Trajectory Contrastive Learning:: Four augmentation strategies generate trajectory views while considering spatial-temporal characteristics and travel semantics.The strategies include trimming, temporal shifting, road-segment masking, and dropout.
  • 2) Trajectory Contrastive Learning:: Temporal shifting perturbs selected road travel times toward historical averages, helping model trajectory travel semantics in the temporal dimension.The selected-road scale is 0.15, with perturbation controlled by a random factor sampled from 0.15–0.30.
  • 2) Trajectory Contrastive Learning:: Contrastive learning uses normalized temperature-scaled cross-entropy with in-batch negatives over augmented trajectory pairs.Cosine similarity and the temperature hyperparameter determine the contrastive objective, whose averaged value is Lcon.
  • 2) Trajectory Contrastive Learning:: The two self-supervised losses are combined during pre-training, with λ balancing span-masked recovery and contrastive learning.The resulting pre-training objective integrates Lmask and Lcon before downstream adaptation.

3) Trajectory Similarity Computation and Search:

The experiments evaluate START and selected self-supervised baselines across downstream tasks and study pre-training, ablations, sensitivity, efficiency, and transfer using BJ and Porto data.

  • 3) Trajectory Similarity Computation and Search:: Experiments compare START with eight baselines on two large-scale datasets and three downstream tasks, reporting superior overall performance.The evaluation covers BJ and Porto and includes a broad performance comparison.
  • 3) Trajectory Similarity Computation and Search:: Self-supervised pre-training reduces training-data usage and supports transfer across heterogeneous datasets and cities.The study frames this transferability as beneficial when labeled training data are insufficient.
  • 3) Trajectory Similarity Computation and Search:: Ablation experiments remove span-masked recovery or contrastive learning to assess the contribution of each self-supervised task.The reported variants are w/o Mask and w/o Contra.
  • 3) Trajectory Similarity Computation and Search:: Parameter sensitivity, efficiency, and scalability studies assess stability over key parameters and suitability for large datasets.These experiments complement the main performance and pre-training evaluations.
  • 3) Trajectory Similarity Computation and Search:: The evaluation uses chronological dataset splits after filtering uncovered roads, loops, short trajectories, low-activity users, and excessive trajectory lengths.BJ and Porto are constructed from real-world trajectory data and OpenStreetMap road networks.

C. Experimental Settings

The experiments use fixed implementation, optimization, augmentation, and evaluation settings for START and its baselines on BJ and Porto.

  • C. Experimental Settings: START uses 256-dimensional embeddings, three TPE-GAT layers, six TAT-Enc layers, and specified attention heads for both modules.The default mask length is 2, mask ratio is 15%, dropout ratio is 0.1, and temperature is 0.05.
  • C. Experimental Settings: Training uses AdamW with batch size 64 for 30 epochs, learning rate 0.0002, warm-up, and cosine annealing.The learning rate increases linearly for five epochs before cosine annealing decreases it.
  • C. Experimental Settings: Travel-time estimation is evaluated with MAE, MAPE, and RMSE, while classification uses accuracy, F1, AUC, Micro-F1, Macro-F1, and Recall@5.Similarity search uses Mean Rank and Hit Ratio metrics, including HR@1 and HR@5.

D. Performance Comparision

START achieves the strongest overall performance across the evaluated downstream tasks and datasets, while its temporal and travel-semantic modeling supports trajectory estimation, classification, and similarity search.

  • Overall Performance: START achieves the best performance on all metrics across the three downstream tasks and two real-world datasets.
  • Performance of Trajectory Travel Time Estimation: START consistently outperforms Trembr and its no-temporal variant across departure times, weekday conditions, and trajectory hop sizes, especially during late peak periods.Removing temporal embeddings and the time-interval matrix worsens performance.
  • Performance of Trajectory Classification: START outperforms all baselines for trajectory classification because it captures underlying travel semantics.
  • Performance of Trajectory Similarity Search: START outperforms all baselines in similarity search, particularly on mean rank, by retrieving trajectories that match both shape and travel semantics.The evaluation uses detour-generated ground truth with Nq = 10,000, Nneg = 100,000, pd = 0.2, and td = 0.2.
  • Performance of Trajectory Similarity Search: As selection proportion pd increases from 0.1 to 0.5, precision declines for all methods, but START remains ahead and decreases more slowly.The comparison fixes k at 5.
  • Performance of Trajectory Similarity Search: START retrieves top-3 trajectories closer to the query than Trembr, including diverse routes with similar shape and origin-destination characteristics.

E. Effect of Pre-training

Pre-training lets START maintain an advantage with reduced labeled data and transfer knowledge from large datasets to small, heterogeneous road-network datasets.

  • Performance Over Small Size Datasets: START consistently outperforms the no-pre-training variant across training sizes from 100k to 400k, and additional pre-training data improves performance more significantly.The experiments cover travel time estimation and trajectory classification.
  • Transfer Model Across Datasets: Pre-training on BJ or Porto improves performance on the small Geolife dataset more than pre-training on Geolife itself, demonstrating transfer across datasets.
  • Transfer Model Across Datasets: START can transfer to heterogeneous road networks because its TPE-GAT parameters are independent of the number of roads when road networks and features are available.

F. Ablation Study

Ablation studies show that START’s graph, temporal, and self-supervised components each contribute materially to downstream performance. Augmentation choices and model hyperparameters also affect results, with temporal-aware strategies performing best in the reported augmentation analysis.

  • Impact of Trajectory Pattern-Enhanced Graph Attention Layer: Removing the TPE-GAT causes a significant performance drop, while its travel-pattern-enhanced representations outperform node2vec and standard GAT alternatives.The comparison attributes the advantage to combining road features and transfer probabilities rather than using only network structure or neighbor aggregation.
  • Impact of Time-Aware Trajectory Encoder: Discarding temporal embeddings or the time-interval matrix significantly degrades performance, confirming the value of periodic patterns and time-aware relative distances.Using hop counts instead of time intervals performs worse than removing the interval matrix, supporting time intervals as the more useful distance signal.
  • Impact of Self-Supervised Tasks: Removing either span-masked recovery or contrastive learning significantly affects downstream performance, indicating that both self-supervised tasks contribute to START.
  • Impact of Data Augmentation Strategies: Temporal Shifting and Road Segments Mask achieve the best travel-time prediction among tested augmentation pairs, while Dropout preserves trajectory semantics as an efficient strategy.The comparison uses MAPE, where lighter colors indicate better performance.
  • Parameter Sensitivity Analysis: Performance initially improves as embedding size and encoder depth increase, then deteriorates when these hyperparameters become too large because of overfitting.

4) Impact of Data Augmentation Strategies:

The supplied passages frame START as a transferable trajectory-representation method whose efficiency comes from offline embeddings and linear-distance computations. They also describe broader self-supervised learning context and future extension plans, rather than reporting additional augmentation-specific findings.

  • Model Efficiency And Scalability: START encodes 100,000 trajectories in 25.8 seconds, with larger inference batches offering further speedups despite added TPE-GAT and time-interval costs.
  • Model Efficiency And Scalability: Deep models are at least one order of magnitude faster than traditional similarity algorithms because representation distances require O(d) rather than generally O(L2) computation.
  • Model Efficiency And Scalability: START’s inference and similarity-search times increase linearly with data volume, supporting scalability to large trajectory datasets.
  • Conclusion: The authors report superior performance over state-of-the-art baselines across two large-scale datasets and three downstream tasks, with transferability across heterogeneous trajectory datasets.They identify cross-dataset transfer as useful when labeled or trajectory data are insufficient.
  • Future Work: Future work will explore downstream-task-specific augmentation techniques and extend START to trajectory types such as POI check-in data.
Loading 2211.09510v4…