# mcagatayc/synthetic-data-gen-for-nw-sec-testing architecture

> Architecture diagram of the GitHub repository mcagatayc/synthetic-data-gen-for-nw-sec-testing, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing
- Repository: https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing

## Overview

This repository is research code for generating synthetic network-traffic data for cybersecurity testing. Its principal workflow prepares and scales traffic records, trains a VAE, encodes records into latent vectors, trains latent diffusion, then generates synthetic records and benchmarks them against real data. A later phase adds CICIDS2017 and UNSW-NB15 generation and comparisons. The graph also retains the separate GAN/Transformer experiments and shared preprocessing utilities. Phase-two scripts are indexed but not excerpted, so their internal links are shown only as unverified.

Main entry points: [`prepare_data.py`](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/prepare_data.py) (Traffic Preprocessing), [`04_generate_and_benchmark.py`](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/04_generate_and_benchmark.py) (Generate and Benchmark), [`02_create_latent_dataset.py`](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/02_create_latent_dataset.py) (Latent Dataset), [`03_train_latent_diffusion.py`](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/03_train_latent_diffusion.py) (Latent Diffusion Training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prep["Data Preparation"]
  node_prep_data["Traffic Preprocessing<br/>[prepare_data.py]"]
  node_prep_libs["Numeric Preprocessing<br/>[prepare_libs.py]"]
  node_phase2_prepare["Phase Two Preparation"]
end

subgraph group_models["Generative Models"]
  node_vae_arch["VAE Model<br/>[vae.py]"]
  node_diff_arch["Diffusion Model<br/>[diffusion.py]"]
  node_gan_model["GAN Model<br/>[gan.py]"]
  node_transformer_model["Transformer Autoencoder<br/>[transformer.py]"]
  node_improved_transformer["Improved Transformer"]
end

subgraph group_workflow["VAE Diffusion Workflow"]
  node_vae_train["VAE Training<br/>[01_train_vae.py]"]
  node_latent_build["Latent Dataset"]
  node_diff_train["Latent Diffusion Training"]
  node_generation["Generate and Benchmark"]
  node_phase2_models["Phase Two Models"]
  node_phase2_generate["Phase Two Generation"]
end

subgraph group_research["Research Evaluation"]
  node_phase2_eval["Phase Two Evaluation"]
  node_metrics["Quality Metrics<br/>[calculate_dcr.py]"]
  node_utility["Utility Evaluation"]
  node_synthetic["Synthetic Traffic"]
end

node_dataset["Network Traffic Data"]
node_researcher(("Researcher"))

node_dataset -->|"loads"| node_prep_data
node_vae_train -->|"uses"| node_prep_data
node_latent_build -->|"uses"| node_prep_data
node_diff_train -->|"uses"| node_prep_data
node_generation -->|"loads and scales"| node_prep_data
node_vae_train -.->|"encodes data"| node_latent_build
node_latent_build -.->|"provides latents"| node_diff_train
node_diff_train -.->|"provides model"| node_generation
node_generation -->|"writes"| node_synthetic
node_generation -.->|"produces results"| node_researcher
node_vae_arch -->|"uses"| node_prep_libs
node_transformer_model -->|"uses"| node_prep_libs
node_improved_transformer -->|"uses"| node_prep_libs
node_phase2_prepare -.->|"prepares inputs"| node_phase2_models
node_phase2_models -.->|"supplies models"| node_phase2_generate
node_phase2_generate -.->|"supplies samples"| node_phase2_eval
node_phase2_eval -.->|"compares quality"| node_metrics
node_phase2_eval -.->|"evaluates utility"| node_utility
node_researcher -.->|"runs training"| node_vae_train
node_researcher -.->|"runs experiments"| node_phase2_prepare

click node_dataset "https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/data/Midterm_53_group.csv"
click node_prep_data "https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/prepare_data.py"
click node_prep_libs "https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/prepare_libs.py"
click node_vae_train "https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/01_train_vae.py"
click node_latent_build "https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/02_create_latent_dataset.py"
click node_diff_train "https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/03_train_latent_diffusion.py"
click node_generation "https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/04_generate_and_benchmark.py"
click node_vae_arch "https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/vae.py"
click node_diff_arch "https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/diffusion.py"
click node_gan_model "https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/gan.py"
click node_transformer_model "https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/transformer.py"
click node_improved_transformer "https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/improved_transformer.py"
click node_phase2_prepare "https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/phase2/01_prepare_phase2.py"
click node_phase2_models "https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/tree/main/phase2"
click node_phase2_generate "https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/phase2/06_generate_with_diffusion_phase2.py"
click node_phase2_eval "https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/phase2/07_evaluate_comparisons_phase2.py"
click node_metrics "https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/calculate_dcr.py"
click node_utility "https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/calculate_utility.py"
click node_synthetic "https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/github_repo/synthetic_data/synthetic_traffic_VAE-LDM.csv"

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_prep_data,node_prep_libs,node_phase2_prepare toneBlue
class node_vae_arch,node_diff_arch,node_gan_model,node_transformer_model,node_improved_transformer toneAmber
class node_vae_train,node_latent_build,node_diff_train,node_generation,node_phase2_models,node_phase2_generate toneMint
class node_phase2_eval,node_metrics,node_utility,node_synthetic toneRose
class node_dataset toneTeal
class node_researcher toneIndigo
```

## Components

### Data Preparation

- [Traffic Preprocessing](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/prepare_data.py): `prepare_data.py`
- [Numeric Preprocessing](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/prepare_libs.py): `prepare_libs.py`
- [Phase Two Preparation](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/phase2/01_prepare_phase2.py): `phase2/01_prepare_phase2.py`

### Generative Models

- [VAE Model](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/vae.py): `vae.py`
- [Diffusion Model](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/diffusion.py): `diffusion.py`
- [GAN Model](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/gan.py): `gan.py`
- [Transformer Autoencoder](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/transformer.py): `transformer.py`
- [Improved Transformer](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/improved_transformer.py): `improved_transformer.py`

### VAE Diffusion Workflow

- [VAE Training](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/01_train_vae.py): `01_train_vae.py`
- [Latent Dataset](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/02_create_latent_dataset.py): `02_create_latent_dataset.py`
- [Latent Diffusion Training](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/03_train_latent_diffusion.py): `03_train_latent_diffusion.py`
- [Generate and Benchmark](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/04_generate_and_benchmark.py): `04_generate_and_benchmark.py`
- [Phase Two Models](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/tree/main/phase2): `phase2`
- [Phase Two Generation](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/phase2/06_generate_with_diffusion_phase2.py): `phase2/06_generate_with_diffusion_phase2.py`

### Research Evaluation

- [Phase Two Evaluation](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/phase2/07_evaluate_comparisons_phase2.py): `phase2/07_evaluate_comparisons_phase2.py`
- [Quality Metrics](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/calculate_dcr.py): `calculate_dcr.py`
- [Utility Evaluation](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/calculate_utility.py): `calculate_utility.py`
- [Synthetic Traffic](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/github_repo/synthetic_data/synthetic_traffic_VAE-LDM.csv): `github_repo/synthetic_data/synthetic_traffic_VAE-LDM.csv`

### Other components

- [Network Traffic Data](https://github.com/mcagatayc/synthetic-data-gen-for-nw-sec-testing/blob/main/data/Midterm_53_group.csv): `data/Midterm_53_group.csv`
- **Researcher**

## Connections

- Network Traffic Data → Traffic Preprocessing: loads (evidence: `prepare_data.py`)
- VAE Training → Traffic Preprocessing: uses (evidence: `01_train_vae.py`)
- Latent Dataset → Traffic Preprocessing: uses (evidence: `02_create_latent_dataset.py`)
- Latent Diffusion Training → Traffic Preprocessing: uses (evidence: `03_train_latent_diffusion.py`)
- Generate and Benchmark → Traffic Preprocessing: loads and scales (evidence: `04_generate_and_benchmark.py`)
- VAE Training → Latent Dataset: encodes data
- Latent Dataset → Latent Diffusion Training: provides latents
- Latent Diffusion Training → Generate and Benchmark: provides model
- Generate and Benchmark → Synthetic Traffic: writes (evidence: `04_generate_and_benchmark.py`)
- Generate and Benchmark → Researcher: produces results
- VAE Model → Numeric Preprocessing: uses (evidence: `vae.py`)
- Transformer Autoencoder → Numeric Preprocessing: uses (evidence: `transformer.py`)
- Improved Transformer → Numeric Preprocessing: uses (evidence: `improved_transformer.py`)
- Phase Two Preparation → Phase Two Models: prepares inputs
- Phase Two Models → Phase Two Generation: supplies models
- Phase Two Generation → Phase Two Evaluation: supplies samples
- Phase Two Evaluation → Quality Metrics: compares quality
- Phase Two Evaluation → Utility Evaluation: evaluates utility
- Researcher → VAE Training: runs training
- Researcher → Phase Two Preparation: runs experiments
