SocioDiff Codebase

May 12, 2025 ยท View on GitHub

This repository contains the source code for our paper:

SocioDiff: A Socio-aware Diffusion Model for Residential Load Data Generation
(Under review)

SocioDiff is a conditional diffusion model that generates realistic electricity consumption time series conditioned on structured socio-demographic information. It is specifically designed to address data scarcity and representational bias in underrepresented communities, and supports fairness-aware data generation for smart grid research.


๐Ÿ“Œ Key Features

  • Conditional diffusion framework integrating social attributes
  • Two-step generation mechanism: global trend + household-specific refinement
  • Fairness-aware adversarial training for disadvantaged groups
  • Compatible with real-world load datasets (e.g., Irish CER dataset)

๐Ÿ“ Repository Structure


โ”œโ”€โ”€ src/                     # Core model components and training pipeline
โ”‚   โ”œโ”€โ”€ models/              # Diffusion and denoising networks (4SD)
โ”‚   โ”œโ”€โ”€ utils/               # Preprocessing, metrics, and functions
โ”‚   โ””โ”€โ”€ train.py             # Training entry point
โ”œโ”€โ”€ configs/                 # Training configuration files
โ”œโ”€โ”€ scripts/                 # Shell scripts for running experiments
โ”œโ”€โ”€ requirements.txt         # Required Python packages
โ””โ”€โ”€ README.md


๐Ÿงช Getting Started

1. Clone the repository

git clone https://github.com/Intelligame/SocialDiff_code.git
cd SocialDiff_code

2. Create environment and install dependencies

conda create -n sociodiff python=3.10
conda activate sociodiff
pip install -r requirements.txt

3. Prepare dataset

  • The synthetic dataset used for evaluation can be found at ๐Ÿ”— https://github.com/Intelligame/SocialDiff
  • To use other datasets, ensure they are formatted as .csv files with socio-demographic fields and normalized load sequences.

4. Run training

python train.py --config configs/sociodiff.yaml

๐Ÿ“Š Evaluation

We provide evaluation metrics including:

  • Maximum Mean Discrepancy (MMD)
  • Context-FID Score
  • Discriminative Score
  • Downstream forecasting performance (MSE, MAE, Rยฒ)

Pre-trained models and evaluation scripts will be released upon acceptance.


๐Ÿ”“ Release Policy

This repository is currently private. We will release the full codebase publicly upon acceptance of the paper. If you are a reviewer and need access, please contact us directly.


๐Ÿ“œ Citation

If you use this framework or dataset, please cite:

@article{SocioDiff2025,
  title={SocioDiff: A Socio-aware Diffusion Model for Residential Load Data Generation},
  author={Chen, Weilong and others},
  journal={IEEE Transactions on Smart Grid},
  year={2025},
  note={Under review}
}

๐Ÿ“ฌ Contact

For questions or collaborations, feel free to contact: Weilong Chen Email: chenweilong921@gmail.com