Skip to content

ChenDelong1999/HHForecasting

Repository files navigation

HH💦Forecasting

Welcome to Hohai University (河海大学) 多模态人工智能实验室 (Artificial Intelligence of Multi-modality Group, AIM Group) time-series forecasting codebase!

This codebase is under active development. If you find any bugs or have any suggestions for code improvement, please raise an issue, thanks🎈

Installation

  • Clone this repo:

    git clone https://github.com/ChenDelong1999/HHForecasting.git
    cd HHForecasting
  • Create a conda virtual environment and activate it:

    conda create -n HHForecasting python=3.6 -y
    conda activate HHForecasting
  • Install PyTorch (official website).

  • Install other requirements:

    conda install tqdm pandas seaborn matplotlib scikit-learn tensorboard -y

Data Preparation

See YuQue Doc for data descriptions.

Dataset Link
屯溪、昌化 (Tunxi, Changhua) BaiduPan (access code: private*)
WaterBench BaiduPan (access code: 03l0)

*Currently we do not plan to make these two datasets to be public. If you are a member of Prof. Fan Liu's lab, contact Prof. Liu (fanliu@hhu.edu.cn) or Delong Chen (chendelong@hhu.edu.cn) for the access code.

Download the dataset and put it to the /dataset folder as follows:

$ tree dataset /f

.. HHForecasting\dataset
├── ChangHua
│   └── data.csv
│
├── TunXi
│   ├── data.csv
│   └── documentation
│       
└── WaterBench
    ├── 1609_data.csv
    ├── 521_data.csv
    ├── ...
    ├── 668_data.csv
    └── 671_data.csv

Flood Forecasting

Machine learning models:

python sklearn_baselines.py

Deep learning models

python train_stage1.py --dataset ChangHua --structure residual --backbone TCN --head conv1d
  • --structure: 'residual' or 'direct' or 'joint'

Few-shot learning

python train_stage1.py --dataset ChangHua --structure residual --backbone TCN --head conv1d --few_shot_num 20 --batch_size 16 --N_EPOCH 1000

'few_shot_num' denotes the number of experiments on each training set scale.

FloodDAN Re-implementation

See our FloodDAN paper below and YuQue Doc for details of this implementation.

Delong Chen, Ruizhi Zhou, Yanling Pan, Fan Liu: A Simple Baseline for Adversarial Domain Adaptation-based Unsupervised Flood Forecasting. Technical Report, ArXiv, CoRR abs/2206.08105 (2022).

Stage 1, pretraining with TunXi dataset

python train_stage1.py --dataset TunXi --structure residual --backbone TCN --head conv1d
  • --structure: 'residual' or 'direct'
  • --backbone: 'TCN' or 'ANN' or 'LSTM' or 'GRU' or 'RNN' or 'STGCN'
  • --head: 'linear' or 'conv1d'

Stage 2, Adversarial domain adaptation

python train_stage2.py --backbone TCN --pre_structure residual --pre_backbone TCN --pre_head conv1d --pretrained_weights runs/<your pretraining run log dir>/last.pt
  • --backbone: 'TCN' or 'ANN' or 'LSTM' or 'GRU' or 'RNN' or 'STGCN'
  • --pre_structure: 'residual' or 'direct'
  • --pre_backbone: 'TCN' or 'ANN' or 'LSTM' or 'GRU' or 'RNN' or 'STGCN'
  • --pre_head: 'linear' or 'conv1d'
  • --pretrained_weights: runs/<your stage 1 run log dir>/last.pt

Monitoring training procedure from tensorboard:

tensorboard --logdir runs

Papers

About

💦 A codebase for data-driven hydrological time-series forecasting, with official implementation of FloodDAN.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages