# sys-arshjeetsingh/bayesian-opt architecture

> Architecture diagram of the GitHub repository sys-arshjeetsingh/bayesian-opt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sys-arshjeetsingh/bayesian-opt
- Repository: https://github.com/sys-arshjeetsingh/bayesian-opt

## Overview

This repository implements a PostgreSQL tuning study: experiment modes apply configurations to a disposable PostgreSQL instance, measure pgbench throughput, and record trial data; analysis summarizes results and generates figures. Baseline, grid search, BO, validation, and supplementary experiments are distinct stages. The graph also shows configuration application and benchmark execution as internal layers. Relationships are based on the supplied source excerpts and README; the standalone connection probe is included, but its relation to the experiment workflow is not established.

Main entry points: [`tune.py`](https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/tune.py) (Experiment Logs), [`supp.py`](https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/supp.py) (Supplementary Runs), [`analyze.py`](https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/analyze.py) (Analysis and Figures), [`db_connection.py`](https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/db_connection.py) (Connection Probe)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experiments["Experiments"]
  node_experiment_cli["Experiment Modes<br/>[tune.py]"]
  node_baseline["Baseline Runs<br/>[tune.py]"]
  node_grid["Grid Search<br/>[tune.py]"]
  node_bo["Bayesian Search<br/>[tune.py]"]
  node_gp_ei["GP and EI<br/>[tune.py]"]
  node_validation["Winner Validation<br/>[tune.py]"]
  node_supplement["Supplementary Runs<br/>[supp.py]"]
end

subgraph group_runtime["Experiment Runtime"]
  node_config["Config Application<br/>[tune.py]"]
  node_postgres[("PostgreSQL")]
  node_benchmark["pgbench Runs<br/>[tune.py]"]
  node_logs["Experiment Logs<br/>[tune.py]"]
  node_connection_probe["Connection Probe<br/>[db_connection.py]"]
end

subgraph group_analysis["Analysis"]
  node_analysis["Analysis and Figures<br/>[analyze.py]"]
  node_artifacts["Results and Figures"]
end

subgraph group_audit["Result Audit"]
  node_verifier["Result Verification<br/>[verify_results.py]"]
end

node_researcher(("Researcher"))

node_researcher -->|"selects mode"| node_experiment_cli
node_experiment_cli -->|"runs"| node_baseline
node_experiment_cli -->|"runs"| node_grid
node_experiment_cli -->|"runs"| node_bo
node_experiment_cli -->|"runs"| node_validation
node_bo -->|"fits and selects"| node_gp_ei
node_supplement -->|"applies settings"| node_config
node_supplement -->|"runs"| node_benchmark
node_baseline -->|"applies settings"| node_config
node_grid -->|"applies settings"| node_config
node_bo -->|"applies candidates"| node_config
node_validation -->|"applies settings"| node_config
node_config -->|"alters and restarts"| node_postgres
node_baseline -->|"evaluates"| node_benchmark
node_grid -->|"evaluates"| node_benchmark
node_bo -->|"evaluates"| node_benchmark
node_validation -->|"evaluates"| node_benchmark
node_benchmark -->|"measures workload"| node_postgres
node_baseline -->|"records trials"| node_logs
node_grid -->|"records trials"| node_logs
node_bo -->|"records trials"| node_logs
node_validation -->|"records trials"| node_logs
node_supplement -->|"writes records"| node_logs
node_logs -->|"reads experiment data"| node_analysis
node_analysis -->|"writes summaries and figures"| node_artifacts
node_logs -->|"audits records"| node_verifier
node_connection_probe -->|"connects"| node_postgres

click node_experiment_cli "https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/tune.py"
click node_baseline "https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/tune.py"
click node_grid "https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/tune.py"
click node_bo "https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/tune.py"
click node_gp_ei "https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/tune.py"
click node_validation "https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/tune.py"
click node_supplement "https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/supp.py"
click node_config "https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/tune.py"
click node_benchmark "https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/tune.py"
click node_logs "https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/tune.py"
click node_analysis "https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/analyze.py"
click node_artifacts "https://github.com/sys-arshjeetsingh/bayesian-opt/tree/main/results"
click node_connection_probe "https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/db_connection.py"
click node_verifier "https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/verify_results.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_experiment_cli,node_baseline,node_grid,node_bo,node_gp_ei,node_validation,node_supplement toneBlue
class node_config,node_postgres,node_benchmark,node_logs,node_connection_probe toneAmber
class node_analysis,node_artifacts toneMint
class node_verifier toneRose
class node_researcher toneIndigo
```

## Components

### Experiments

- [Experiment Modes](https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/tune.py): `tune.py`
- [Baseline Runs](https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/tune.py): `tune.py`
- [Grid Search](https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/tune.py): `tune.py`
- [Bayesian Search](https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/tune.py): `tune.py`
- [GP and EI](https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/tune.py): `tune.py`
- [Winner Validation](https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/tune.py): `tune.py`
- [Supplementary Runs](https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/supp.py): `supp.py`

### Experiment Runtime

- [Config Application](https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/tune.py): `tune.py`
- **PostgreSQL**
- [pgbench Runs](https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/tune.py): `tune.py`
- [Experiment Logs](https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/tune.py): `tune.py`
- [Connection Probe](https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/db_connection.py): `db_connection.py`

### Analysis

- [Analysis and Figures](https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/analyze.py): `analyze.py`
- [Results and Figures](https://github.com/sys-arshjeetsingh/bayesian-opt/tree/main/results): `results`

### Result Audit

- [Result Verification](https://github.com/sys-arshjeetsingh/bayesian-opt/blob/main/verify_results.py): `verify_results.py`

### Other components

- **Researcher**

## Connections

- Researcher → Experiment Modes: selects mode (evidence: `README.md`)
- Experiment Modes → Baseline Runs: runs (evidence: `tune.py`)
- Experiment Modes → Grid Search: runs (evidence: `tune.py`)
- Experiment Modes → Bayesian Search: runs (evidence: `tune.py`)
- Experiment Modes → Winner Validation: runs (evidence: `tune.py`)
- Bayesian Search → GP and EI: fits and selects (evidence: `tune.py`)
- Supplementary Runs → Config Application: applies settings (evidence: `supp.py`)
- Supplementary Runs → pgbench Runs: runs (evidence: `supp.py`)
- Baseline Runs → Config Application: applies settings (evidence: `tune.py`)
- Grid Search → Config Application: applies settings (evidence: `tune.py`)
- Bayesian Search → Config Application: applies candidates (evidence: `tune.py`)
- Winner Validation → Config Application: applies settings (evidence: `tune.py`)
- Config Application → PostgreSQL: alters and restarts (evidence: `tune.py`)
- Baseline Runs → pgbench Runs: evaluates (evidence: `tune.py`)
- Grid Search → pgbench Runs: evaluates (evidence: `tune.py`)
- Bayesian Search → pgbench Runs: evaluates (evidence: `tune.py`)
- Winner Validation → pgbench Runs: evaluates (evidence: `tune.py`)
- pgbench Runs → PostgreSQL: measures workload (evidence: `tune.py`)
- Baseline Runs → Experiment Logs: records trials (evidence: `tune.py`)
- Grid Search → Experiment Logs: records trials (evidence: `tune.py`)
- Bayesian Search → Experiment Logs: records trials (evidence: `tune.py`)
- Winner Validation → Experiment Logs: records trials (evidence: `tune.py`)
- Supplementary Runs → Experiment Logs: writes records (evidence: `supp.py`)
- Experiment Logs → Analysis and Figures: reads experiment data (evidence: `analyze.py`)
- Analysis and Figures → Results and Figures: writes summaries and figures (evidence: `analyze.py`)
- Experiment Logs → Result Verification: audits records (evidence: `verify_results.py`)
- Connection Probe → PostgreSQL: connects (evidence: `db_connection.py`)
