# vkzapple/sgnn architecture

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

- Interactive diagram: https://gitdiagram.com/vkzapple/sgnn
- Repository: https://github.com/vkzapple/sgnn

## Overview

SGNN-AGB is a research prototype for online predictive learning on non-stationary streams. The principal workflow is to generate or prepare a stream, train the SGNN one step at a time, let the adaptive controller choose structural actions, and evaluate predictive error and continual-learning behavior. The graph also preserves the repository’s documented real-data benchmarks and older controller. Source links are limited to README statements and shown or indexed references; unsampled wiring is omitted.

Main entry points: [`experiments/run_fase5_clear10.py`](https://github.com/vkzapple/sgnn/blob/main/experiments/run_fase5_clear10.py) (Clear-10 benchmark), [`experiments/run_experiment_v2.py`](https://github.com/vkzapple/sgnn/blob/main/experiments/run_experiment_v2.py) (V2 experiment), [`experiments/run_fase3.py`](https://github.com/vkzapple/sgnn/blob/main/experiments/run_fase3.py) (Multi-seed study), [`src/controller/agc_v2.py`](https://github.com/vkzapple/sgnn/blob/main/src/controller/agc_v2.py) (Adaptive controller v2)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Streams and features"]
  node_synthetic["Synthetic streams"]
  node_moa["MOA streams"]
  node_clear10["Clear-10 features"]
  node_cifar["CIFAR-100 features"]
  node_taobao_data["Taobao loader<br/>[taobao_data.py]"]
  node_video_data["Video features<br/>[video_data.py]"]
end

subgraph group_runtime["Adaptive learner"]
  node_sgnn["SGNN core<br/>[sgnn_core.py]"]
  node_agc_v2["Adaptive controller v2<br/>[agc_v2.py]"]
  node_agc["Original controller<br/>[agc.py]"]
end

subgraph group_benchmarks["Experiment runners"]
  node_phase2["V2 experiment"]
  node_phase3["Multi-seed study<br/>[run_fase3.py]"]
  node_phase4["MOA benchmark<br/>[run_fase4.py]"]
  node_phase5["Clear-10 benchmark"]
  node_phase6["Split-CIFAR benchmark"]
  node_other_benchmarks["Other data benchmarks"]
end

subgraph group_evaluation["Evaluation"]
  node_cl_metrics["Continual metrics<br/>[cl_metrics.py]"]
  node_results["Experiment results"]
end

node_researcher(("Researcher"))

node_researcher -->|"runs"| node_phase2
node_researcher -->|"runs"| node_phase3
node_researcher -->|"runs"| node_phase4
node_researcher -->|"runs"| node_phase5
node_researcher -->|"runs"| node_phase6
node_phase2 -->|"generates input"| node_synthetic
node_phase3 -->|"generates input"| node_synthetic
node_phase4 -->|"generates input"| node_moa
node_phase2 -->|"trains online"| node_sgnn
node_phase3 -->|"trains online"| node_sgnn
node_phase4 -->|"trains online"| node_sgnn
node_phase5 -->|"trains online"| node_sgnn
node_phase6 -->|"reuses runner"| node_phase5
node_phase2 -->|"updates actions"| node_agc_v2
node_phase3 -->|"updates actions"| node_agc_v2
node_phase4 -->|"updates actions"| node_agc_v2
node_phase5 -->|"controls growth"| node_agc_v2
node_agc_v2 -->|"uses buffer helpers"| node_agc
node_phase5 -->|"extracts features"| node_clear10
node_phase6 -->|"prepares features"| node_cifar
node_other_benchmarks -->|"loads Taobao"| node_taobao_data
node_other_benchmarks -->|"loads video"| node_video_data
node_phase3 -.->|"measures learning"| node_cl_metrics
node_other_benchmarks -->|"measures learning"| node_cl_metrics
node_phase2 -->|"writes logs"| node_results
node_phase5 -->|"writes results"| node_results
node_phase6 -->|"writes results"| node_results

click node_synthetic "https://github.com/vkzapple/sgnn/blob/main/src/eval/synthetic_stream.py"
click node_moa "https://github.com/vkzapple/sgnn/blob/main/src/eval/stream_generators.py"
click node_clear10 "https://github.com/vkzapple/sgnn/blob/main/experiments/run_fase5_clear10.py"
click node_cifar "https://github.com/vkzapple/sgnn/blob/main/experiments/run_fase6_cifar100.py"
click node_taobao_data "https://github.com/vkzapple/sgnn/blob/main/experiments/taobao_data.py"
click node_video_data "https://github.com/vkzapple/sgnn/blob/main/experiments/video_data.py"
click node_sgnn "https://github.com/vkzapple/sgnn/blob/main/src/core/sgnn_core.py"
click node_agc_v2 "https://github.com/vkzapple/sgnn/blob/main/src/controller/agc_v2.py"
click node_agc "https://github.com/vkzapple/sgnn/blob/main/src/controller/agc.py"
click node_phase2 "https://github.com/vkzapple/sgnn/blob/main/experiments/run_experiment_v2.py"
click node_phase3 "https://github.com/vkzapple/sgnn/blob/main/experiments/run_fase3.py"
click node_phase4 "https://github.com/vkzapple/sgnn/blob/main/experiments/run_fase4.py"
click node_phase5 "https://github.com/vkzapple/sgnn/blob/main/experiments/run_fase5_clear10.py"
click node_phase6 "https://github.com/vkzapple/sgnn/blob/main/experiments/run_fase6_cifar100.py"
click node_other_benchmarks "https://github.com/vkzapple/sgnn/tree/main/experiments"
click node_cl_metrics "https://github.com/vkzapple/sgnn/blob/main/experiments/cl_metrics.py"
click node_results "https://github.com/vkzapple/sgnn/tree/main/results"

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_synthetic,node_moa,node_clear10,node_cifar,node_taobao_data,node_video_data toneBlue
class node_sgnn,node_agc_v2,node_agc toneAmber
class node_phase2,node_phase3,node_phase4,node_phase5,node_phase6,node_other_benchmarks toneMint
class node_cl_metrics,node_results toneRose
class node_researcher toneIndigo
```

## Components

### Streams and features

- [Synthetic streams](https://github.com/vkzapple/sgnn/blob/main/src/eval/synthetic_stream.py): `src/eval/synthetic_stream.py`
- [MOA streams](https://github.com/vkzapple/sgnn/blob/main/src/eval/stream_generators.py): `src/eval/stream_generators.py`
- [Clear-10 features](https://github.com/vkzapple/sgnn/blob/main/experiments/run_fase5_clear10.py): `experiments/run_fase5_clear10.py`
- [CIFAR-100 features](https://github.com/vkzapple/sgnn/blob/main/experiments/run_fase6_cifar100.py): `experiments/run_fase6_cifar100.py`
- [Taobao loader](https://github.com/vkzapple/sgnn/blob/main/experiments/taobao_data.py): `experiments/taobao_data.py`
- [Video features](https://github.com/vkzapple/sgnn/blob/main/experiments/video_data.py): `experiments/video_data.py`

### Adaptive learner

- [SGNN core](https://github.com/vkzapple/sgnn/blob/main/src/core/sgnn_core.py): `src/core/sgnn_core.py`
- [Adaptive controller v2](https://github.com/vkzapple/sgnn/blob/main/src/controller/agc_v2.py): `src/controller/agc_v2.py`
- [Original controller](https://github.com/vkzapple/sgnn/blob/main/src/controller/agc.py): `src/controller/agc.py`

### Experiment runners

- [V2 experiment](https://github.com/vkzapple/sgnn/blob/main/experiments/run_experiment_v2.py): `experiments/run_experiment_v2.py`
- [Multi-seed study](https://github.com/vkzapple/sgnn/blob/main/experiments/run_fase3.py): `experiments/run_fase3.py`
- [MOA benchmark](https://github.com/vkzapple/sgnn/blob/main/experiments/run_fase4.py): `experiments/run_fase4.py`
- [Clear-10 benchmark](https://github.com/vkzapple/sgnn/blob/main/experiments/run_fase5_clear10.py): `experiments/run_fase5_clear10.py`
- [Split-CIFAR benchmark](https://github.com/vkzapple/sgnn/blob/main/experiments/run_fase6_cifar100.py): `experiments/run_fase6_cifar100.py`
- [Other data benchmarks](https://github.com/vkzapple/sgnn/tree/main/experiments): `experiments`

### Evaluation

- [Continual metrics](https://github.com/vkzapple/sgnn/blob/main/experiments/cl_metrics.py): `experiments/cl_metrics.py`
- [Experiment results](https://github.com/vkzapple/sgnn/tree/main/results): `results`

### Other components

- **Researcher**

## Connections

- Researcher → V2 experiment: runs (evidence: `README.md`)
- Researcher → Multi-seed study: runs (evidence: `README.md`)
- Researcher → MOA benchmark: runs (evidence: `README.md`)
- Researcher → Clear-10 benchmark: runs (evidence: `README.md`)
- Researcher → Split-CIFAR benchmark: runs (evidence: `README.md`)
- V2 experiment → Synthetic streams: generates input (evidence: `experiments/run_experiment_v2.py`)
- Multi-seed study → Synthetic streams: generates input (evidence: `experiments/run_fase3.py`)
- MOA benchmark → MOA streams: generates input (evidence: `experiments/run_fase4.py`)
- V2 experiment → SGNN core: trains online (evidence: `experiments/run_experiment_v2.py`)
- Multi-seed study → SGNN core: trains online (evidence: `experiments/run_fase3.py`)
- MOA benchmark → SGNN core: trains online (evidence: `experiments/run_fase4.py`)
- Clear-10 benchmark → SGNN core: trains online (evidence: `README.md`)
- Split-CIFAR benchmark → Clear-10 benchmark: reuses runner (evidence: `experiments/run_fase6_cifar100.py`)
- V2 experiment → Adaptive controller v2: updates actions (evidence: `experiments/run_experiment_v2.py`)
- Multi-seed study → Adaptive controller v2: updates actions (evidence: `experiments/run_fase3.py`)
- MOA benchmark → Adaptive controller v2: updates actions (evidence: `experiments/run_fase4.py`)
- Clear-10 benchmark → Adaptive controller v2: controls growth (evidence: `README.md`)
- Adaptive controller v2 → Original controller: uses buffer helpers (evidence: `src/controller/agc_v2.py`)
- Clear-10 benchmark → Clear-10 features: extracts features (evidence: `README.md`)
- Split-CIFAR benchmark → CIFAR-100 features: prepares features (evidence: `experiments/run_fase6_cifar100.py`)
- Other data benchmarks → Taobao loader: loads Taobao (evidence: `README.md`)
- Other data benchmarks → Video features: loads video (evidence: `README.md`)
- Multi-seed study → Continual metrics: measures learning
- Other data benchmarks → Continual metrics: measures learning (evidence: `README.md`)
- V2 experiment → Experiment results: writes logs (evidence: `README.md`)
- Clear-10 benchmark → Experiment results: writes results (evidence: `README.md`)
- Split-CIFAR benchmark → Experiment results: writes results (evidence: `README.md`)
