Datasets:
Download Replication_Explanatory_File.txt from tjtrans/FORESEE: direct link, hf CLI and curl.
- Browser
- Download file 5.83 kB
-
https://huggingface.co/datasets/tjtrans/FORESEE/resolve/main/Replication_Explanatory_File.txt
- Command line
-
hf download hf://datasets/tjtrans/FORESEE/Replication_Explanatory_File.txt
-
curl -L -o Replication_Explanatory_File.txt https://huggingface.co/datasets/tjtrans/FORESEE/resolve/main/Replication_Explanatory_File.txt
5.83 kB
| Replication package explanatory file | |
| Journal title: Communications in Transportation Research (COMMTR) | |
| Manuscript title: Learning from Yesterday's Error: An Efficient Online Learning Method for Traffic Demand Prediction | |
| Manuscript ID: [to be filled after ScholarOne submission] | |
| Authors: [to be filled in author order] | |
| Replication package access | |
| The complete replication package is deposited on Hugging Face Datasets (processed data under CC0; code under MIT) and mirrored on GitHub. After ETS-Data assigns a DOI, replace the placeholder below and also update the short summary in the manuscript (before Acknowledgements). | |
| Hugging Face: https://huggingface.co/datasets/tjtrans/FORESEE | |
| ETS-Data: https://doi.org/10.26599/ETSD.XXXX.XXXXXXX | |
| Code mirror: https://github.com/xiannanhuang/FORESEE | |
| Unzip FORESEE_replication_package.zip. All relative paths below are relative to the FORESEE/ root. | |
| The archive contains: | |
| 1. dataset/<dataset_name>/train.npy, val.npy, test.npy, adj_mx.npy for nycbike, nyctaxi, chibike, chitaxi, bosbike, baybike, torbike. | |
| 2. saved_models/ checkpoints that reproduce the paper tables (14 files): | |
| STGCN and GWNET on all seven datasets. | |
| 3. models/*_config.yaml and model source files. | |
| 4. Source codes: train.py, foresee.py, eval_reproduce.py, fintune_opencity.py, Dataset.py, modules under models/ and tools/, and OpenCity configs in opencity/*.yaml. | |
| 5. expected_results/paper_metrics.csv for checking reproduced MAE/RMSE. | |
| Data description | |
| We provide processed secondary demand tensors, not raw trip records. These files are sufficient to reproduce the verified Ori and FORESEE numbers listed above. | |
| Each dataset folder contains: | |
| - train.npy / val.npy / test.npy: hourly inflow/outflow demand. Accepted shapes: (nodes, days, 24, 2) or hour-first (hours, nodes, 2). The last dimension is 2 (pick-up and drop-off, or equivalent inflow/outflow). | |
| - adj_mx.npy: spatial adjacency among zones, float32, shape (N, N). | |
| The tensors are aggregated from publicly released bike-sharing and taxi trip records of New York City, Chicago, Boston, the San Francisco Bay Area, and Toronto. We split them chronologically into train/validation/test and drop zones whose training-period mean demand is <= 2 (paper Section 5.1.1). After this filter, valid zone counts are: nycbike 74, nyctaxi 125, chibike 48, chitaxi 28, bosbike 43, baybike 36, torbike 36. | |
| Raw trip-level microdata are not redistributed because they are large and already public from the original operators or open-data portals. The processed tensors fully determine the reported metrics. | |
| Code description | |
| Required environment: | |
| - OS: Windows or Linux | |
| - Python >= 3.8 | |
| - GPU recommended (device: cuda:0 in YAML); CPU works if device is set to cpu | |
| - packages listed in requirements.txt: torch, numpy, scikit-learn, pyyaml, scipy, pandas, tqdm, statsmodels | |
| Install: | |
| pip install -r requirements.txt | |
| Main reproduction (no retraining): | |
| python foresee.py | |
| This evaluates the 14 verified checkpoint pairs and writes online.csv. Compare with expected_results/paper_metrics.csv. | |
| Subset evaluation: | |
| python eval_reproduce.py --jobs stgcn --out logs/reproduce_stgcn.jsonl --device cuda:0 | |
| python eval_reproduce.py --jobs gwnet --out logs/reproduce_gwnet.jsonl --device cuda:0 | |
| FORESEE online settings (foresee.py, class Online_day): | |
| - residual experts with EMA coefficients [0.7, 0.8, 0.9, 1.0] | |
| - expert-weight temperature eta=10 | |
| - adaptive spatiotemporal smoothing: graph diffusion (alpha init 0.01) and temporal kernel [0.2, 0.6, 0.2], updated by SGD (lr=0.01) | |
| - test loader batch size = 24 (one day); the residual is updated once per day using yesterday's error | |
| - look-back window = 6 hours; prediction horizon = 1 hour | |
| OpenCity backbone (optional) | |
| The main STGCN / GWNET tables do not require OpenCity. To reproduce the OpenCity experiments we provide fintune_opencity.py and the dataset configs under opencity/*.yaml. The official OpenCity pretrained weights are not redistributed here; download OpenCity-base.pth from the OpenCity authors and place it at opencity/OpenCity-base.pth. | |
| Step 1. Fine-tune OpenCity on a target dataset. In fintune_opencity.py, set | |
| config_path = r'opencity/<dataset>.yaml' | |
| and uncomment | |
| torch.save(model.state_dict(), 'finetuned_opencity_<dataset>.pth') | |
| Default example is chibike. Then run: | |
| python fintune_opencity.py | |
| Step 2. Run FORESEE on the fine-tuned OpenCity model. In foresee.py, switch init_model to | |
| llm='opencity' | |
| config_path = r'opencity/<dataset>.yaml' | |
| and load the matching checkpoint, e.g. | |
| torch.load(r'finetuned_opencity_<dataset>.pth') | |
| When constructing Online_day and calling online(), also pass llm='opencity' so that the OpenCity forward signature is used. Then run: | |
| python foresee.py | |
| Change <dataset> among nycbike, nyctaxi, chibike, chitaxi, bosbike, baybike, torbike. Keep device in the corresponding yaml consistent with the local GPU. | |
| Simulation software description | |
| Not applicable. This study does not use traffic microsimulation. All experiments are supervised forecasting on historical demand tensors. | |
| Experiment design description | |
| Not applicable. There are no surveys, questionnaires, or human-subject experiments. Evaluation is rolling hourly prediction on the held-out test split, reported as MAE and RMSE after inverse standardization. | |
| Others | |
| 1. Zone filter and adjacency indexing must stay consistent: paper_valid_grid() selects zones and load_paper_adj() slices adj_mx with the same index. | |
| 2. Features are standardized with a scaler fitted only on training data (CustomStandardScaler); MAE/RMSE are computed after inverse_transform. | |
| 3. Set device in each models/*_config.yaml to match the local machine. | |
| 4. All 14 STGCN / GWNET checkpoints are released. | |