Skip to content

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

SynEnergy: Anomaly Semantic-Guided Diffusion for Synthetic Energy Data Generation

Official implementation of SynEnergy, a two-stage diffusion framework for anomaly-preserving synthetic energy data generation.

  • HG-ASL learns region-specific anomaly semantics from residual consumption patterns and cross-region dependencies.
  • AS-Diff injects the learned anomaly semantics into a diffusion Backbone Denoiser through AS-Control.

Framework

SynEnergy framework

Results

SynEnergy results

Stage Components Role
HG-ASL SR-Encoder, AS-Pooling, RAPA-Graph Learns region-specific anomaly semantics
AS-Diff Backbone Denoiser, AS-Control Generates anomaly-preserving synthetic consumption data

Configuration: SynEnergy/Config/Extreme/power_FL.yaml

Bundled data: SynEnergy/Data/Power/Tallahassee_seq_180_sample_10000.npy


Setup

conda create -n SynEnergy python=3.10 -y
conda activate SynEnergy
cd SynEnergy
pip install -U pip
pip install -r requirements.txt

Python 3.10+ and a CUDA-enabled GPU are recommended.


Quick Start

Run the full SynEnergy pipeline from the SynEnergy/ directory:

bash Bash/run_power_FL1.sh

The script sequentially trains the Backbone Denoiser, trains HG-ASL and AS-Control, and generates 10,000 synthetic sequences.

Generated outputs are saved to:

OUTPUT/power_FL1/

You can evaluate the generated data using Metric_Check.ipynb with:

RUN_NAME = "power_FL1"

Manual Commands

Run the following commands from SynEnergy/:

cd SynEnergy

CONFIG=Config/Extreme/power_FL.yaml
NAME=power_FL1

Step 1: Train the Backbone Denoiser

python main.py \
  --name "${NAME}" \
  --config_file "${CONFIG}" \
  --train \
  --heavy \
  --condition

Step 2: Train HG-ASL and AS-Control

python main.py \
  --name "${NAME}" \
  --config_file "${CONFIG}" \
  --train \
  --heavy \
  --controlnet \
  --condition

Step 3: Generate Synthetic Data

python main.py \
  --name "${NAME}" \
  --config_file "${CONFIG}" \
  --sample \
  --heavy \
  --controlnet \
  --condition

Optional arguments:

--seed 42
--sample_seed 42

Outputs

Main artifacts are written to SynEnergy/OUTPUT/power_FL1/. Below are the key output files (not an exhaustive list):

File Description
origin_data_norm_power_FL1.npy Original training sequences (MinMax-normalized)
origin_data_unnorm_power_FL1.npy Original training sequences (denormalized, physical scale)
generate_data_norm_power_FL1.npy Generated synthetic sequences (MinMax-normalized)
generate_data_unnorm_power_FL1.npy Generated synthetic sequences (denormalized, physical scale)

Evaluation

After run_power_FL1.sh finishes successfully, open SynEnergy/Experiment/Result_Analysis/Metric_Check.ipynb and run all cells in order from top to bottom. The notebook loads origin_data and generate_data from OUTPUT/power_FL1/ (default RUN_NAME = "power_FL1") and reports all metrics.

SynEnergy/Experiment/Result_Analysis/Metric_Check.ipynb

The evaluation includes:

  • Overall Generation Fidelity: T-Wass., D-Wass., S-Wass., MMD
  • Anomaly Preservation Fidelity: A-Rate, A-Count, A-Energy, A-Tail
  • Downstream Quality: Det-PRAUC, Pred-PRAUC

Repository Layout

SynEnergy/
├── main.py
├── Config/
│   └── Extreme/
│       └── power_FL.yaml
├── Data/
│   └── Power/
├── controlnet/
├── Models/
├── Figures/
│   ├── Framework.png
│   └── Table.png
├── Bash/
│   └── run_power_FL1.sh
└── Experiment/
    └── Result_Analysis/
        └── Metric_Check.ipynb

Baselines

We compare SynEnergy with 11 baseline methods across seven categories.

Baseline Category Venue GitHub
TimeGAN GAN NeurIPS 2019 https://github.com/AlexanderVNikitin/tsgm/blob/main/tsgm/models/timeGAN.py
TimeVAE VAE arXiv 2021 https://github.com/wangyz1999/timeVAE-pytorch
koVAE VAE ICLR 2024 https://github.com/azencot-group/KoVAE
F-Flow Flow ICLR 2021 https://github.com/ahmedmalaa/Fourier-flows
DiffWave Diffusion ICLR 2021 https://github.com/lmnt-com/diffwave
Diffusion-TS Diffusion ICLR 2024 https://github.com/Y-debug-sys/Diffusion-TS
SDForger LLM NeurIPS 2025 https://github.com/IBM/fms-dgt/tree/main/fms_dgt/public/databuilders/time_series
FIDE Extreme-Aware NeurIPS 2024 https://github.com/galib19/FIDE
HeavyDiff Extreme-Aware ICLR 2025 https://github.com/Y-debug-sys/Diffusion-TS
CENTS Electricity-Specific arXiv 2025 https://github.com/DAI-Lab/Cents
Cond-Diff Electricity-Specific Energy and Buildings 2024 https://github.com/buds-lab/energy-diffusion

Citation

Citation information will be added after publication.

Acknowledgements

We sincerely thank the authors of the following projects for making their code publicly available:

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages