Giter VIP home page Giter VIP logo

corrformer's Introduction

Corrformer (Nature Machine Intelligence)

In this paper, we present Corrformer with the Multi-Correlation mechanism, which can unify the temporal auto-correlation and spatial correlation in a learned multiscale tree structure.

  • Corrformer reduces the canonical double quadratic complexity of spatiotemporal modeling to linear in spatial modeling and log-linear in temporal modeling, firstly achieving collaborative forecasts for tens of thousands of stations within a unified deep model.
  • Corrformer can generate interpretable predictions based on inferred propagation directions of weather processes, facilitating a fully data-driven AI paradigm for discovering insights for meteorological science.
  • Corrformer yields state-of-the-art forecasts on global, regional and citywide datasets with high confidence, beating classical statistical methods, latest deep models, and comparing favorably to numerical methods in near-surface forecasting.

🚩News (2023.06) Our paper has been published in Nature Machine Intelligence as the Cover Article.

Code Structure

|-- Corrformer
   |-- data_provider # Data loader
   |-- exp # Pipelines for train, validation and test
   |-- layers 
   |   |-- Embed.py # Equ (1) of the paper
   |   |-- Corrformer_EncDec.py # Equ (2) and Equ (3) of the paper
   |   |-- Causal_Conv.py # Causal conv for Cross-Correlation
   |   |-- Multi_Correlation.py # Equ (5)-(10) of the paper
   |-- models
   |   |-- Corrformer.py # Overall framework
   |-- utils
   |-- scripts # Running scripts
   |-- dataset # Place the download datsets here
   |-- checkpoints # Place the output or pretrained models here

Reproduction

  1. Find a device with GPU support. Our experiment is conducted on a single RTX 24GB GPU and in the Linux system.
  2. Install Python 3.6, PyTorch 1.7.1. The following script can be convenient.
pip install -r requirements.txt # take about 5 minutes
  1. Download the dataset from [Code Ocean]. And place them under the ./dataset folder.

  2. Train and evaluate the model with the following scripts.

bash ./scripts/Global_Temp/Corrformer.sh # take about 18 hours
bash ./scripts/Global_Wind/Corrformer.sh # take about 18 hours

Note: Since the raw data for Global Temp and Global Wind from the NCEI has been multiplied by ten times, the actual MSE and MAE for these two benchmarks should be divided by 100 and 10 respectively.

Demo

For a simple demo, we would recommend the experiments with the pre-trained models, which can provide a fast test of our code. Here are the detailed instructions:

  1. Configure the environment with the above instructions. Note that the following experiments will take 4GB GPU memory.
  2. Download the datasets and pretrained models from [Datasets] and [Pretrained Models]. Place the pretrained models under the ./checkpoints folder.
  3. Execute the demo with the following scripts.
bash ./scripts/Demo/Global_Temp_demo.sh # take about 35 minutes
bash ./scripts/Demo/Global_Wind_demo.sh # take about 35 minutes

Note again: Since the raw data for Global Temp and Global Wind from the NCEI has been multiplied by ten times, the actual MSE and MAE for these two benchmarks should be divided by 100 and 10 respectively.

Citation

If you find this repo useful, please cite our paper.

@article{wu2023corrformer,
  title={Interpretable Weather Forecasting for Worldwide Stations with a Unified Deep Model},
  author={Haixu Wu and Hang Zhou and Mingsheng Long and Jianmin Wang},
  journal={Nature Machine Intelligence},
  year={2023},
}

Contact

If you have any questions or suggestions, feel free to contact Haixu Wu ([email protected] or [email protected]).

corrformer's People

Contributors

wuhaixu2016 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  avatar  avatar  avatar  avatar

corrformer's Issues

消融实验中tree结构

您好,在文章中消融实验部分,您是如何实现消除tree结构呢?
通过修改参数(--node_num --node_list)实现吗?
还是修改encoder - decoder等部分呢?
期待您的回复。

about the data preprocess code

Hi, authors.
Can you release the code for data preprocess or how you use the blank series to train the model?
thank you!

About the dataset

May I ask the author, is the data needed for Demo still open? At present, the link you provided can not be opened

About Tree-based multi-scale structure

How to do 'the tree is built on the geographical locations of stations by hierarchical neighbourhood clustering'?
In this part, is the order of nodes divided according to the clustering results before the data is input?
Not reflected in the code

Thanks and regards

多尺度树结构构建问题

作者您好!在使用层次领域聚类算法应用站点位置信息构建多尺度数时,尺度为0时,叶子节点为站点,能够理解使用kmeans算法对叶子节点聚类再根据聚类结果对站点排序;那尺度为1时,如何使用kmeans算法聚类?还是应用在所有站点数据上吗?还是应用在尺度为0的聚类结果至上,根据尺度为0时聚类得到的簇,计算每个簇地理位置的平均值,然后再对这些平均值应用kmeans?作者能否清楚解答一下使用聚类算法对站点排序这块的内容,不胜感激!

Questions about the dataset

Many thanks to the authors for opening up the source code and dataset.

I have a question about the dataset. In the Global wind/temp dataset, stations_sorted.npy seems to have sorted the stations. The tree structure of the network is also built directly based on the sorted stations. So if I were to apply Corrformer to other datasets, in what order should stations be fed into the network? Or what preprocessing do I need to do with other station datasets? I really hope to get help from the authors. Thank you very much.

anyone know how much GPU memory needed?

Try using the script located at ‘scripts/Global_Temp/Corrformer.sh’ to train model 48 for predicting 24. How much GPU memory is required? And do you have any solutions to reduce it? 16GB is insufficient.

Questions about data processing

Hi authors, thank you very much for your very interesting open source work.

when i run the following code

bash ./scripts/Global_Temp/Corrformer.sh

I found that at the following code

x_enc = x_enc.view(B, L, self.node_num, -1).permute(0, 2, 1, 3).contiguous() \
.view(B * self.node_num, L, D // self.node_num)

Before enc_embedding and encoder, the code will change the input x_enc from [1, 48, 3850] dimensions to [350, 48, 11]. I don't quite understand why?
I can understand that 3850 is the number of stations and 48 is the length of time, but why should it become 350? Will this aggregate data from several stations together? What does this variable node_num represent?

Looking forward to your answer, thank you.

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.