Skip to content

Latest commit

 

History

History
84 lines (56 loc) · 2.55 KB

File metadata and controls

84 lines (56 loc) · 2.55 KB

TimeGuard: Channel-wise Pool Training for Backdoor Defense in Time Series Forecasting

This repository provides code to (1) run TSF backdoor attacks to produce poisoned data, and (2) apply TimeGuard to defend against them.


Table of Contents


1. Prerequisites

  • Python 3.10+

  • Install dependencies:

    pip install -r requirements.txt

2. Configuration

  • configs/default_config.yaml Global defaults (model, dataset, target pattern list, etc.)

  • configs/attacks/*.yaml Attack configurations (hyperparameters, training details, poison rate, trigger settings, etc.)

  • configs/timeguard/**/TimeGuard.yaml TimeGuard defense configurations per dataset / model / attack save folder results from attack methods


3. Run the Framework

3.1 Running Attacks

Train an attacker and generate a poisoned dataset (BackTime on PEMS03):

python attack_backtime_run.py \
  --train_config_path configs/attacks/PEMS03_backtime_FEDformer_1212_attack.yaml

3.2 Running TimeGuard

Apply TimeGuard against a specified attack setting (example: defend against the above BackTime attack):

python defense_timeguard.py \
  --defense_config_path configs/timeguard/PEMS03_backtime_FEDformer_1212/FEDformer/TimeGuard.yaml

4. Datasets

TimeGuard is validated on three real-world datasets and put it in under ./data folder:


Acknowledgement