{"id":13526396,"url":"https://github.com/nnzhan/MTGNN","last_synced_at":"2025-04-01T07:32:22.832Z","repository":{"id":37649058,"uuid":"266665160","full_name":"nnzhan/MTGNN","owner":"nnzhan","description":null,"archived":false,"fork":false,"pushed_at":"2023-07-06T22:00:30.000Z","size":51,"stargazers_count":778,"open_issues_count":20,"forks_count":219,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-08-02T06:20:45.665Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nnzhan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-05-25T02:28:11.000Z","updated_at":"2024-08-01T06:20:58.000Z","dependencies_parsed_at":"2024-01-12T17:34:35.794Z","dependency_job_id":"b91063bc-f6a6-480f-b4c6-194ae5f547ee","html_url":"https://github.com/nnzhan/MTGNN","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnzhan%2FMTGNN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnzhan%2FMTGNN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnzhan%2FMTGNN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnzhan%2FMTGNN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nnzhan","download_url":"https://codeload.github.com/nnzhan/MTGNN/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222709540,"owners_count":17026763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:01:29.068Z","updated_at":"2024-11-02T11:30:50.038Z","avatar_url":"https://github.com/nnzhan.png","language":"Python","funding_links":[],"categories":["Papers","时间序列"],"sub_categories":["2020","网络服务_其他"],"readme":"# MTGNN\nThis is a PyTorch implementation of the paper: [Connecting the Dots: Multivariate Time Series Forecasting with Graph Neural Networks](https://arxiv.org/abs/2005.11650), published in KDD-2020.\n\n## Requirements\nThe model is implemented using Python3 with dependencies specified in requirements.txt\n## Data Preparation\n### Multivariate time series datasets\n\nDownload Solar-Energy, Traffic, Electricity, Exchange-rate datasets from [https://github.com/laiguokun/multivariate-time-series-data](https://github.com/laiguokun/multivariate-time-series-data). Uncompress them and move them to the data folder.\n\n### Traffic datasets\nDownload the METR-LA and PEMS-BAY dataset from [Google Drive](https://drive.google.com/open?id=10FOTa6HXPqX8Pf5WRoRwcFnW9BrNZEIX) or [Baidu Yun](https://pan.baidu.com/s/14Yy9isAIZYdU__OYEQGa_g) provided by [Li et al.](https://github.com/liyaguang/DCRNN.git) . Move them into the data folder. \n\n```\n\n# Create data directories\nmkdir -p data/{METR-LA,PEMS-BAY}\n\n# METR-LA\npython generate_training_data.py --output_dir=data/METR-LA --traffic_df_filename=data/metr-la.h5\n\n# PEMS-BAY\npython generate_training_data.py --output_dir=data/PEMS-BAY --traffic_df_filename=data/pems-bay.h5\n\n```\n\n## Model Training\n\n### Single-step\n\n* Solar-Energy\n\n```\npython train_single_step.py --save ./model-solar-3.pt --data ./data/solar_AL.txt --num_nodes 137 --batch_size 4 --epochs 30 --horizon 3\n#sampling\npython train_single_step.py --num_split 3 --save ./model-solar-sampling-3.pt --data ./data/solar_AL.txt --num_nodes 137 --batch_size 16 --epochs 30 --horizon 3\n```\n* Traffic \n\n```\npython train_single_step.py --save ./model-traffic3.pt --data ./data/traffic.txt --num_nodes 862 --batch_size 16 --epochs 30 --horizon 3\n#sampling\npython train_single_step.py --num_split 3 --save ./model-traffic-sampling-3.pt --data ./data/traffic --num_nodes 321 --batch_size 16 --epochs 30 --horizon 3\n```\n\n* Electricity\n\n```\npython train_single_step.py --save ./model-electricity-3.pt --data ./data/electricity.txt --num_nodes 321 --batch_size 4 --epochs 30 --horizon 3\n#sampling \npython train_single_step.py --num_split 3 --save ./model-electricity-sampling-3.pt --data ./data/electricity.txt --num_nodes 321 --batch_size 16 --epochs 30 --horizon 3\n```\n\n* Exchange-Rate\n\n```\npython train_single_step.py --save ./model/model-exchange-3.pt --data ./data/exchange_rate.txt --num_nodes 8 --subgraph_size 8  --batch_size 4 --epochs 30 --horizon 3\n#sampling\npython train_single_step.py --num_split 3 --save ./model-exchange-3.pt --data ./data/exchange_rate.txt --num_nodes 8 --subgraph_size 2  --batch_size 16 --epochs 30 --horizon 3\n```\n### Multi-step\n* METR-LA\n\n```\npython train_multi_step.py --adj_data ./data/sensor_graph/adj_mx.pkl --data ./data/METR-LA --num_nodes 207\n```\n* PEMS-BAY\n\n```\npython train_multi_step.py --adj_data ./data/sensor_graph/adj_mx_bay.pkl --data ./data/PEMS-BAY/ --num_nodes 325\n```\n\n## Citation\n\n```\n@inproceedings{wu2020connecting,\n  title={Connecting the Dots: Multivariate Time Series Forecasting with Graph Neural Networks},\n  author={Wu, Zonghan and Pan, Shirui and Long, Guodong and Jiang, Jing and Chang, Xiaojun and Zhang, Chengqi},\n  booktitle={Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery \\\u0026 Data Mining},\n  year={2020}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnnzhan%2FMTGNN","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnnzhan%2FMTGNN","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnnzhan%2FMTGNN/lists"}