# yashotharas/ldp_energy architecture

> Architecture diagram of the GitHub repository yashotharas/ldp_energy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yashotharas/ldp_energy
- Repository: https://github.com/yashotharas/ldp_energy

## Overview

This repository implements experiments in local differential privacy for smart-meter energy data: it loads or synthesizes appliance readings, encodes energy levels, applies privacy-budget allocation and randomized response, and evaluates utility. The README also documents adaptive budget division and normal, skewed, and uniform synthetic data. The graph preserves these capabilities and the Laplacian benchmark. Some post-processing and benchmark modules were not shown in detail, so their internal connections are omitted rather than inferred.

Main entry points: [`LDPEnergyCodes/Budget_division.py`](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/Budget_division.py) (Adaptive budget division), [`LDPEnergyCodes/Preprocessing_and_encoding.py`](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/Preprocessing_and_encoding.py) (Energy encoding), [`LDPEnergyCodes/SyntheticDatasetCreation/Normal_distribution.py`](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/SyntheticDatasetCreation/Normal_distribution.py) (Normal data experiment), [`LDPEnergyCodes/SyntheticDatasetCreation/Uniform_distribution.py`](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/SyntheticDatasetCreation/Uniform_distribution.py) (Uniform data experiment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Energy data"]
  node_real_loader["IDEAL data loading<br/>[Data_loading.py]"]
  node_augmentation["Data augmentation"]
  node_preprocess["Energy encoding"]
end

subgraph group_privacy["Privacy pipeline"]
  node_main["Single-run experiment<br/>[main.py]"]
  node_iter_main["Iterative experiment"]
  node_budget["Adaptive budget division<br/>[Budget_division.py]"]
  node_randomiser["LDP randomization<br/>[Randomiser.py]"]
  node_helper["Encoding and metrics helpers<br/>[Helper.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_bench_main["Benchmark experiment"]
  node_postprocess["Application post-processing"]
  node_statistics["Statistical analysis"]
  node_laplacian["Laplacian mechanism<br/>[LaplacianLDP.py]"]
  node_concurrent_bench["Concurrent benchmarks"]
end

subgraph group_synthetic["Synthetic data"]
  node_normal["Normal data experiment"]
  node_skewed["Skewed data experiment"]
  node_uniform["Uniform data experiment"]
  node_real_synthetic["IDEAL-based synthesis"]
  node_synthesiser["Distribution synthesizer<br/>[Synthesiser.py]"]
end

node_user(("Experimenter"))

node_user -->|"runs"| node_main
node_user -->|"runs"| node_bench_main
node_main -->|"loads data"| node_real_loader
node_main -->|"encodes readings"| node_preprocess
node_main -->|"allocates budget"| node_budget
node_iter_main -->|"loads data"| node_real_loader
node_iter_main -->|"encodes readings"| node_preprocess
node_iter_main -->|"allocates budget"| node_budget
node_bench_main -->|"applies noise"| node_laplacian
node_real_loader -->|"augments users"| node_augmentation
node_budget -->|"perturbs bits"| node_randomiser
node_budget -->|"measures distance"| node_helper
node_normal -->|"generates data"| node_synthesiser
node_normal -->|"encodes readings"| node_preprocess
node_normal -->|"allocates budget"| node_budget
node_normal -->|"decodes levels"| node_helper
node_uniform -->|"generates data"| node_synthesiser
node_uniform -->|"encodes readings"| node_preprocess
node_uniform -->|"allocates budget"| node_budget
node_uniform -->|"uses helpers"| node_helper
node_real_synthetic -->|"encodes readings"| node_preprocess
node_real_synthetic -->|"allocates budget"| node_budget
node_real_synthetic -->|"uses helpers"| node_helper

click node_real_loader "https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/DataLoading/Data_loading.py"
click node_augmentation "https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/DataLoading/Data_augmentation.py"
click node_preprocess "https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/Preprocessing_and_encoding.py"
click node_main "https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/main.py"
click node_iter_main "https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/main_with_iteration.py"
click node_bench_main "https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/main_benchmarking.py"
click node_budget "https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/Budget_division.py"
click node_randomiser "https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/Randomiser.py"
click node_helper "https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/Helper.py"
click node_postprocess "https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/PostProcessing/Postprocessing_application_level.py"
click node_statistics "https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/PostProcessing/Statistical_analysis.py"
click node_laplacian "https://github.com/yashotharas/ldp_energy/blob/master/Benchmarking/LaplacianLDP.py"
click node_concurrent_bench "https://github.com/yashotharas/ldp_energy/blob/master/Benchmarking/concurrent_benchmarking.py"
click node_normal "https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/SyntheticDatasetCreation/Normal_distribution.py"
click node_skewed "https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/SyntheticDatasetCreation/Skewed_distribution.py"
click node_uniform "https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/SyntheticDatasetCreation/Uniform_distribution.py"
click node_real_synthetic "https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/SyntheticDatasetCreation/Real_sysnthetic_data_processing.py"
click node_synthesiser "https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/SyntheticDatasetCreation/Synthesiser.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_real_loader,node_augmentation,node_preprocess toneBlue
class node_main,node_iter_main,node_budget,node_randomiser,node_helper toneAmber
class node_bench_main,node_postprocess,node_statistics,node_laplacian,node_concurrent_bench toneMint
class node_normal,node_skewed,node_uniform,node_real_synthetic,node_synthesiser toneRose
class node_user toneIndigo
```

## Components

### Energy data

- [IDEAL data loading](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/DataLoading/Data_loading.py): `LDPEnergyCodes/DataLoading/Data_loading.py`
- [Data augmentation](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/DataLoading/Data_augmentation.py): `LDPEnergyCodes/DataLoading/Data_augmentation.py`
- [Energy encoding](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/Preprocessing_and_encoding.py): `LDPEnergyCodes/Preprocessing_and_encoding.py`

### Privacy pipeline

- [Single-run experiment](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/main.py): `LDPEnergyCodes/main.py`
- [Iterative experiment](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/main_with_iteration.py): `LDPEnergyCodes/main_with_iteration.py`
- [Adaptive budget division](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/Budget_division.py): `LDPEnergyCodes/Budget_division.py`
- [LDP randomization](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/Randomiser.py): `LDPEnergyCodes/Randomiser.py`
- [Encoding and metrics helpers](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/Helper.py): `LDPEnergyCodes/Helper.py`

### Evaluation

- [Benchmark experiment](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/main_benchmarking.py): `LDPEnergyCodes/main_benchmarking.py`
- [Application post-processing](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/PostProcessing/Postprocessing_application_level.py): `LDPEnergyCodes/PostProcessing/Postprocessing_application_level.py`
- [Statistical analysis](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/PostProcessing/Statistical_analysis.py): `LDPEnergyCodes/PostProcessing/Statistical_analysis.py`
- [Laplacian mechanism](https://github.com/yashotharas/ldp_energy/blob/master/Benchmarking/LaplacianLDP.py): `Benchmarking/LaplacianLDP.py`
- [Concurrent benchmarks](https://github.com/yashotharas/ldp_energy/blob/master/Benchmarking/concurrent_benchmarking.py): `Benchmarking/concurrent_benchmarking.py`

### Synthetic data

- [Normal data experiment](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/SyntheticDatasetCreation/Normal_distribution.py): `LDPEnergyCodes/SyntheticDatasetCreation/Normal_distribution.py`
- [Skewed data experiment](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/SyntheticDatasetCreation/Skewed_distribution.py): `LDPEnergyCodes/SyntheticDatasetCreation/Skewed_distribution.py`
- [Uniform data experiment](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/SyntheticDatasetCreation/Uniform_distribution.py): `LDPEnergyCodes/SyntheticDatasetCreation/Uniform_distribution.py`
- [IDEAL-based synthesis](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/SyntheticDatasetCreation/Real_sysnthetic_data_processing.py): `LDPEnergyCodes/SyntheticDatasetCreation/Real_sysnthetic_data_processing.py`
- [Distribution synthesizer](https://github.com/yashotharas/ldp_energy/blob/master/LDPEnergyCodes/SyntheticDatasetCreation/Synthesiser.py): `LDPEnergyCodes/SyntheticDatasetCreation/Synthesiser.py`

### Other components

- **Experimenter**

## Connections

- Experimenter → Single-run experiment: runs (evidence: `README.md`)
- Experimenter → Benchmark experiment: runs (evidence: `README.md`)
- Single-run experiment → IDEAL data loading: loads data (evidence: `LDPEnergyCodes/main.py`)
- Single-run experiment → Energy encoding: encodes readings (evidence: `LDPEnergyCodes/main.py`)
- Single-run experiment → Adaptive budget division: allocates budget (evidence: `LDPEnergyCodes/main.py`)
- Iterative experiment → IDEAL data loading: loads data (evidence: `LDPEnergyCodes/main_with_iteration.py`)
- Iterative experiment → Energy encoding: encodes readings (evidence: `LDPEnergyCodes/main_with_iteration.py`)
- Iterative experiment → Adaptive budget division: allocates budget (evidence: `LDPEnergyCodes/main_with_iteration.py`)
- Benchmark experiment → Laplacian mechanism: applies noise (evidence: `LDPEnergyCodes/main_benchmarking.py`)
- IDEAL data loading → Data augmentation: augments users (evidence: `LDPEnergyCodes/DataLoading/Data_loading.py`)
- Adaptive budget division → LDP randomization: perturbs bits (evidence: `LDPEnergyCodes/Budget_division.py`)
- Adaptive budget division → Encoding and metrics helpers: measures distance (evidence: `LDPEnergyCodes/Budget_division.py`)
- Normal data experiment → Distribution synthesizer: generates data (evidence: `LDPEnergyCodes/SyntheticDatasetCreation/Normal_distribution.py`)
- Normal data experiment → Energy encoding: encodes readings (evidence: `LDPEnergyCodes/SyntheticDatasetCreation/Normal_distribution.py`)
- Normal data experiment → Adaptive budget division: allocates budget (evidence: `LDPEnergyCodes/SyntheticDatasetCreation/Normal_distribution.py`)
- Normal data experiment → Encoding and metrics helpers: decodes levels (evidence: `LDPEnergyCodes/SyntheticDatasetCreation/Normal_distribution.py`)
- Uniform data experiment → Distribution synthesizer: generates data (evidence: `LDPEnergyCodes/SyntheticDatasetCreation/Uniform_distribution.py`)
- Uniform data experiment → Energy encoding: encodes readings (evidence: `LDPEnergyCodes/SyntheticDatasetCreation/Uniform_distribution.py`)
- Uniform data experiment → Adaptive budget division: allocates budget (evidence: `LDPEnergyCodes/SyntheticDatasetCreation/Uniform_distribution.py`)
- Uniform data experiment → Encoding and metrics helpers: uses helpers (evidence: `LDPEnergyCodes/SyntheticDatasetCreation/Uniform_distribution.py`)
- IDEAL-based synthesis → Energy encoding: encodes readings (evidence: `LDPEnergyCodes/SyntheticDatasetCreation/Real_sysnthetic_data_processing.py`)
- IDEAL-based synthesis → Adaptive budget division: allocates budget (evidence: `LDPEnergyCodes/SyntheticDatasetCreation/Real_sysnthetic_data_processing.py`)
- IDEAL-based synthesis → Encoding and metrics helpers: uses helpers (evidence: `LDPEnergyCodes/SyntheticDatasetCreation/Real_sysnthetic_data_processing.py`)
