Giter VIP home page Giter VIP logo

pm2.5-gnn's Introduction

PM2.5-GNN

PM2.5-GNN: A Domain Knowledge Enhanced Graph Neural Network For PM2.5 Forecasting

Dataset

Requirements

Python 3.7.3
PyTorch 1.7.0
PyG: https://github.com/rusty1s/pytorch_geometric#pytorch-170
pip install -r requirements.txt

Experiment Setup

open config.yaml, do the following setups.

  • set data path after your server name. Like mine.

filepath:
  GPU-Server:
    knowair_fp: /data/wangshuo/haze/pm25gnn/KnowAir.npy
    results_dir: /data/wangshuo/haze/pm25gnn/results
  • Uncomment the model you want to run.
#  model: MLP
#  model: LSTM
#  model: GRU
#  model: GC_LSTM
#  model: nodesFC_GRU
   model: PM25_GNN
#  model: PM25_GNN_nosub
  • Choose the sub-datast number in [1,2,3].
 dataset_num: 3
  • Set weather variables you wish to use. Following is the default setting in the paper. You can uncomment specific variables. Variables in dataset KnowAir is defined in metero_var.
  metero_use: ['2m_temperature',
               'boundary_layer_height',
               'k_index',
               'relative_humidity+950',
               'surface_pressure',
               'total_precipitation',
               'u_component_of_wind+950',
               'v_component_of_wind+950',]

Run

python train.py

Reference

Paper: https://dl.acm.org/doi/10.1145/3397536.3422208

@inproceedings{10.1145/3397536.3422208,
author = {Wang, Shuo and Li, Yanran and Zhang, Jiang and Meng, Qingye and Meng, Lingwei and Gao, Fei},
title = {PM2.5-GNN: A Domain Knowledge Enhanced Graph Neural Network For PM2.5 Forecasting},
year = {2020},
isbn = {9781450380195},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3397536.3422208},
doi = {10.1145/3397536.3422208},
abstract = {When predicting PM2.5 concentrations, it is necessary to consider complex information sources since the concentrations are influenced by various factors within a long period. In this paper, we identify a set of critical domain knowledge for PM2.5 forecasting and develop a novel graph based model, PM2.5-GNN, being capable of capturing long-term dependencies. On a real-world dataset, we validate the effectiveness of the proposed model and examine its abilities of capturing both fine-grained and long-term influences in PM2.5 process. The proposed PM2.5-GNN has also been deployed online to provide free forecasting service.},
booktitle = {Proceedings of the 28th International Conference on Advances in Geographic Information Systems},
pages = {163–166},
numpages = {4},
keywords = {air quality prediction, graph neural network, spatio-temporal prediction},
location = {Seattle, WA, USA},
series = {SIGSPATIAL '20}
}

pm2.5-gnn's People

Contributors

shuowang-ai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pm2.5-gnn's Issues

predict.npy shape問題

您好,我嘗試執行了您的程式
我列印了predict.npy的形狀,若沒改變參數的話,shape=(192, 25, 184, 1)
我了解25為過去一筆+未來24筆; 184為城市數量; 1為單點預測
不過我不太懂192的表達意思,我看了前面幾個回答,了解跟batch_size有關,
請問是筆數除以batch_size嗎?

报错

请问这行代码代表什么呢?
nodename = os.uname().nodename
file_dir = config['filepath'][nodename]

运行的时候报了如下错误
file_dir = config['filepath'][nodename]
E KeyError: '20190629UJF'
collected 0 items / 1 errors

配置问题

请问大佬
你在config.yaml中设置了
knowair_fp: /data/wangshuo/haze/pm25gnn/KnowAir.npy
results_dir: /data/wangshuo/haze/pm25gnn/results
可你代码的data中没有KnowAir.npy和results,这怎么办呢,求助一下

代码保存

请问这个问题这个解决?
Train epoch 0:
0it [00:00, ?it/s]
Traceback (most recent call last):
File "/content/drive/MyDrive/ColabNotebooks/PM25/PM2.5-GNN/train.py", line 288, in
main()
File "/content/drive/MyDrive/ColabNotebooks/PM25/PM2.5-GNN/train.py", line 224, in main
train_loss = train(train_loader, model, optimizer)
File "/content/drive/MyDrive/ColabNotebooks/PM25/PM2.5-GNN/train.py", line 118, in train
for batch_idx, data in tqdm(enumerate(train_loader)):
File "/usr/local/lib/python3.10/dist-packages/tqdm/std.py", line 1181, in iter
for obj in iterable:
File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py", line 631, in next
data = self._next_data()
File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py", line 675, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/fetch.py", line 54, in fetch
return self.collate_fn(data)
File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/collate.py", line 277, in default_collate
return collate(batch, collate_fn_map=default_collate_fn_map)
File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/collate.py", line 144, in collate
return [collate(samples, collate_fn_map=collate_fn_map) for samples in transposed] # Backwards compatibility.
File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/collate.py", line 144, in
return [collate(samples, collate_fn_map=collate_fn_map) for samples in transposed] # Backwards compatibility.
File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/collate.py", line 121, in collate
return collate_fn_map[elem_type](batch, collate_fn_map=collate_fn_map)
File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/collate.py", line 181, in collate_numpy_array_fn
raise TypeError(default_collate_err_msg_format.format(elem.dtype))
TypeError: default_collate: batch must contain tensors, numpy arrays, numbers, dicts or lists; found object

配置问题

请问 torch-sparse,torch-scatter,torch-cluster, torch-geometric的版本分别是是什么,这些包之间的冲突有点厉害

KownAir数据集的shape

作者您好!KownAir的数据格式为 (11688, 184, 18),通过您在其他issue的回复,我得知PM2.5为第1维数据。我想知道后面17维数据分别代表什么?是否有详细的说明?
期待您的回复,祝您万事顺遂!

数据集相关问题

您好
在data路径下有一个station_info.csv文件,是表示在收集数据的时候,有收集到站点粒度的数据,然后再汇总得到城市粒度的数据吗?
如果已有站点粒度的数据,请问方便提供一下吗?
谢谢!
期待您的回复

About the KnowAir dataset

The shape of KnowAir.npy is (11688, 184, 18), but the "metero_var" in config.yaml only has 17 variables.

模型输出文件

我在尝试学习和复现您的模型,有几个问题想请教一下:
1、您提供的data文件夹里的station_info.csv的作用是什么,我打开后发现表格里的出现了很多乱码
2、请问您是如何将您的预测结果可视化的

配置问题

大佬,现在那个pyramid-arima已经不支持使用了,然后如果用更新的python版本和pytorch版本可以向下兼容吗?
我尝试着想要跑通可是一直在graph那边卡住该怎么办啊T T

How to update KnowAir dataset

If I want to reproduce the results of the paper with data up to 2022, where can I download and update KnowAir dataset?
Thx ^^

Some confusion about GC-LSTM

In GC-LSTM.py, the edge_index was changed:

self.edge_index = self.edge_index.view(2, 1, -1).repeat(1, batch_size, 1) + torch.arange(batch_size).view(1, -1, 1) * batch_size

This edge_index was expended by this code, and the node number (e.g., 1174) exceed the maximum city number 184.
So what's the meaning of this code for modifying the edge_index? And does the code existing some error?

diffusion coefficient S

请问代码中计算对流系数的时候为什么要乘以3呢?

edge_weight = F.relu(3 * src_wind_speed * torch.cos(theta) / city_dist)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.