--- tags: - traffic-forecasting - time-series - graph-neural-network - transformer - stgformer datasets: - metr-la --- # STGformer Model - METR-LA Spatio-Temporal Graph Transformer (STGformer) trained on METR-LA dataset for traffic speed forecasting. ## Model Description This model uses a transformer-based graph neural network architecture that combines: - Self-attention mechanisms for capturing temporal dependencies - Spatial graph convolution for modeling spatial relationships - Adaptive embeddings for learning node-specific patterns - Time-of-day embeddings for capturing daily patterns ## Evaluation Metrics - **Test MAE (15 min)**: 2.5637 - **Test MAPE (15 min)**: 0.0654 - **Test RMSE (15 min)**: 4.8755 ## Dataset **METR-LA**: Traffic speed data from highway sensors. ## Usage ```python from utils.stgformer import load_from_hub # Load model from Hub model, scaler = load_from_hub("METR-LA") # Get predictions import numpy as np x = np.random.randn(10, 12, 207, 2) # (batch, seq_len, nodes, [value, tod]) predictions = model.predict(x) ``` ## Training Model was trained using the STGformer implementation with configuration: - Input features: 2 [speed, time-of-day] - Time-of-day embedding dimension: 24 - Day-of-week embedding dimension: 0 (disabled) - Adaptive embedding dimension: 80 - Number of attention heads: 4 - Number of layers: 3 ## Citation If you use this model, please cite the STGformer paper: ```bibtex @article{stgformer, title={STGformer: Spatio-Temporal Graph Transformer for Traffic Forecasting}, author={Author names}, journal={Conference/Journal}, year={Year} } ``` ## License This model checkpoint is released under the same license as the training code.