# rsoumyadeep/activerl_gp architecture

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

- Interactive diagram: https://gitdiagram.com/rsoumyadeep/activerl_gp
- Repository: https://github.com/rsoumyadeep/activerl_gp

## Overview

1. This repository is a research codebase for **active offline reinforcement learning using Gaussian Processes**. It is centered around learning from a fixed offline dataset rather than interacting with an environment online.

2. The core model layer lives in three files:
   - `model_vgp.py`
   - `model_vsvgp.py`
   - `model_qsvgp.py`
   
   These are likely different GP-based model variants used for value/Q-function estimation and sparse variational approximations. This is the main architectural boundary of the repo: model definitions are separated from dataset handling, visualization, and experiment scripts.

3. The data layer is under `data/`, with a specific `data/D4RL/` namespace and `namespace_metadata.json`. This strongly suggests the code consumes **D4RL offline RL datasets**, especially maze-style tasks. The repository is not built around live environment rollouts; it appears to train and evaluate on stored trajectories.

4. The saved artifacts live under `saves/`, including a checkpoint-like directory:
   - `saves/maze2d-umaze-v1_seed42_inducing15001`
   
   This indicates the workflow is: load dataset → train GP model → persist experiment outputs/checkpoints per environment/seed/settings. The save path encodes the environment, random seed, and inducing-point count, which are important experiment parameters.

5. Utility and support code is split out into:
   - `utils.py`
   - `viz_utils.py`
   
   These likely contain shared helpers for preprocessing, numerical operations, plotting support, and experiment plumbing. They form the glue between the model code and the scripts.

6. Visualization is a distinct subsystem:
   - `visualize_maze_dataset.py`
   
   This script likely renders maze trajectories or dataset coverage for D4RL maze tasks. It suggests the repo includes an analysis/inspection workflow for understanding the offline dataset distribution, which matters in active offline RL.

7. The execution/experiment entry points appear to be the standalone scripts:
   - `test.py`
   - `t2.py`
   - `t4.py`
   - `t5.py`
   - `t6.py`
   
   These are probably iterative experiment drivers, ablation scripts, or prototype runs rather than a single unified training CLI. Architecturally, they sit above the model layer and orchestrate training/evaluation/plotting.

8. The likely data flow is:
   - D4RL dataset files are loaded from `data/`
   - preprocessing and experiment logic are handled via `utils.py`
   - one of the GP model variants is instantiated and trained
   - results are written to `saves/`
   - visualization scripts read datasets or outputs for inspection

9. The main external dependency implied by the layout is **D4RL**, specifically maze2d tasks. That means the project’s architecture is shaped by offline RL benchmark data formats and benchmark-specific environment metadata rather than a general-purpose application backend.

10. The repository has a compact, experiment-oriented structure: models are isolated, data is vendored locally, and outputs are stored by experiment folder. There is no sign of a separate service layer, database, or frontend; the architecture is a single-machine scientific workflow with scripts as the orchestration boundary.

11. For an architecture diagram, the most important boxes are:
   - offline D4RL maze dataset input
   - GP model variants
   - experiment/training scripts
   - visualization scripts
   - saved checkpoints/results
   
   The arrows should show offline data flowing into preprocessing and model training, then into saved artifacts and visualization/evaluation.

Main entry points: [`data`](https://github.com/rsoumyadeep/activerl_gp/tree/main/data) (Dataset root), [`test.py`](https://github.com/rsoumyadeep/activerl_gp/blob/main/test.py) (Test runner), [`t2.py`](https://github.com/rsoumyadeep/activerl_gp/blob/main/t2.py) (Run t2), [`t4.py`](https://github.com/rsoumyadeep/activerl_gp/blob/main/t4.py) (Run t4)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Offline data"]
  node_data_root[("Dataset root<br/>dataset tree")]
  node_d4rl_meta["Namespace meta<br/>metadata"]
end

subgraph group_models["GP models"]
  node_vgp["VGP model<br/>[model_vgp.py]"]
  node_vsvgp["VSVGP model<br/>[model_vsvgp.py]"]
  node_qsvgp["QSVGP model<br/>[model_qsvgp.py]"]
end

subgraph group_scripts["Experiment scripts"]
  node_test_script["Test runner<br/>script<br/>[test.py]"]
  node_t2_script["Run t2<br/>script<br/>[t2.py]"]
  node_t4_script["Run t4<br/>script<br/>[t4.py]"]
  node_t5_script["Run t5<br/>script<br/>[t5.py]"]
  node_t6_script["Run t6<br/>script<br/>[t6.py]"]
  node_viz_script["Maze viz<br/>script"]
end

subgraph group_support["Support code"]
  node_utils["Utils<br/>helpers<br/>[utils.py]"]
  node_viz_utils["Viz utils<br/>plot helpers<br/>[viz_utils.py]"]
end

subgraph group_artifacts["Saved outputs"]
  node_saves_root[("Saved runs<br/>artifacts")]
end

node_data_root -->|"namespaces"| node_d4rl_meta
node_d4rl_meta -.->|"configures"| node_test_script
node_d4rl_meta -.->|"configures"| node_t2_script
node_d4rl_meta -.->|"configures"| node_t4_script
node_d4rl_meta -.->|"configures"| node_t5_script
node_d4rl_meta -.->|"configures"| node_t6_script
node_data_root -->|"loads"| node_test_script
node_data_root -->|"loads"| node_t2_script
node_data_root -->|"loads"| node_t4_script
node_data_root -->|"loads"| node_t5_script
node_data_root -->|"loads"| node_t6_script
node_test_script -->|"uses"| node_utils
node_t2_script -->|"uses"| node_utils
node_t4_script -->|"uses"| node_utils
node_t5_script -->|"uses"| node_utils
node_t6_script -->|"uses"| node_utils
node_test_script -->|"trains"| node_vgp
node_test_script -->|"trains"| node_vsvgp
node_test_script -->|"trains"| node_qsvgp
node_t2_script -->|"trains"| node_vgp
node_t2_script -->|"trains"| node_vsvgp
node_t2_script -->|"trains"| node_qsvgp
node_t4_script -->|"trains"| node_vgp
node_t4_script -->|"trains"| node_vsvgp
node_t4_script -->|"trains"| node_qsvgp
node_viz_script -->|"uses"| node_viz_utils
node_viz_script -->|"inspects"| node_data_root
node_vgp -->|"writes"| node_saves_root
node_vsvgp -->|"writes"| node_saves_root
node_qsvgp -->|"writes"| node_saves_root
node_test_script -->|"reads/writes"| node_saves_root
node_t2_script -->|"reads/writes"| node_saves_root
node_t4_script -->|"reads/writes"| node_saves_root
node_t5_script -->|"reads/writes"| node_saves_root
node_t6_script -->|"reads/writes"| node_saves_root

click node_data_root "https://github.com/rsoumyadeep/activerl_gp/tree/main/data"
click node_d4rl_meta "https://github.com/rsoumyadeep/activerl_gp/blob/main/data/D4RL/namespace_metadata.json"
click node_vgp "https://github.com/rsoumyadeep/activerl_gp/blob/main/model_vgp.py"
click node_vsvgp "https://github.com/rsoumyadeep/activerl_gp/blob/main/model_vsvgp.py"
click node_qsvgp "https://github.com/rsoumyadeep/activerl_gp/blob/main/model_qsvgp.py"
click node_test_script "https://github.com/rsoumyadeep/activerl_gp/blob/main/test.py"
click node_t2_script "https://github.com/rsoumyadeep/activerl_gp/blob/main/t2.py"
click node_t4_script "https://github.com/rsoumyadeep/activerl_gp/blob/main/t4.py"
click node_t5_script "https://github.com/rsoumyadeep/activerl_gp/blob/main/t5.py"
click node_t6_script "https://github.com/rsoumyadeep/activerl_gp/blob/main/t6.py"
click node_viz_script "https://github.com/rsoumyadeep/activerl_gp/blob/main/visualize_maze_dataset.py"
click node_utils "https://github.com/rsoumyadeep/activerl_gp/blob/main/utils.py"
click node_viz_utils "https://github.com/rsoumyadeep/activerl_gp/blob/main/viz_utils.py"
click node_saves_root "https://github.com/rsoumyadeep/activerl_gp/tree/main/saves"

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_data_root,node_d4rl_meta toneBlue
class node_vgp,node_vsvgp,node_qsvgp toneAmber
class node_test_script,node_t2_script,node_t4_script,node_t5_script,node_t6_script,node_viz_script toneMint
class node_utils,node_viz_utils toneRose
class node_saves_root toneIndigo
```

## Components

### Offline data

Vendored D4RL maze datasets and namespace metadata.

- [Dataset root](https://github.com/rsoumyadeep/activerl_gp/tree/main/data): dataset tree · Local offline RL data inputs. · `data`
- [Namespace meta](https://github.com/rsoumyadeep/activerl_gp/blob/main/data/D4RL/namespace_metadata.json): metadata · Dataset namespace metadata for D4RL. · `data/D4RL/namespace_metadata.json`

### GP models

Gaussian-process value and Q-function model variants.

- [VGP model](https://github.com/rsoumyadeep/activerl_gp/blob/main/model_vgp.py): gp model · Variational GP value-model variant. · `model_vgp.py`
- [VSVGP model](https://github.com/rsoumyadeep/activerl_gp/blob/main/model_vsvgp.py): gp model · Sparse variational GP model variant. · `model_vsvgp.py`
- [QSVGP model](https://github.com/rsoumyadeep/activerl_gp/blob/main/model_qsvgp.py): gp model · Sparse variational GP Q-function variant. · `model_qsvgp.py`

### Experiment scripts

Standalone training, testing, and ablation entry points.

- [Test runner](https://github.com/rsoumyadeep/activerl_gp/blob/main/test.py): script · Primary test or evaluation entry point. · `test.py`
- [Run t2](https://github.com/rsoumyadeep/activerl_gp/blob/main/t2.py): script · Standalone experiment driver. · `t2.py`
- [Run t4](https://github.com/rsoumyadeep/activerl_gp/blob/main/t4.py): script · Standalone experiment driver. · `t4.py`
- [Run t5](https://github.com/rsoumyadeep/activerl_gp/blob/main/t5.py): script · Standalone experiment driver. · `t5.py`
- [Run t6](https://github.com/rsoumyadeep/activerl_gp/blob/main/t6.py): script · Standalone experiment driver. · `t6.py`
- [Maze viz](https://github.com/rsoumyadeep/activerl_gp/blob/main/visualize_maze_dataset.py): script · Offline maze dataset visualization entry point. · `visualize_maze_dataset.py`

### Support code

Shared utilities and visualization helpers.

- [Utils](https://github.com/rsoumyadeep/activerl_gp/blob/main/utils.py): helpers · Shared preprocessing and experiment helpers. · `utils.py`
- [Viz utils](https://github.com/rsoumyadeep/activerl_gp/blob/main/viz_utils.py): plot helpers · Shared plotting and visualization helpers. · `viz_utils.py`

### Saved outputs

Per-run checkpoints and experiment artifacts.

- [Saved runs](https://github.com/rsoumyadeep/activerl_gp/tree/main/saves): artifacts · Checkpoint and result directories keyed by experiment settings. · `saves`

## Connections

- Dataset root → Namespace meta: namespaces · Dataset organization and metadata.
- Namespace meta → Test runner: configures · Run metadata informs experiment setup.
- Namespace meta → Run t2: configures · Run metadata informs experiment setup.
- Namespace meta → Run t4: configures · Run metadata informs experiment setup.
- Namespace meta → Run t5: configures · Run metadata informs experiment setup.
- Namespace meta → Run t6: configures · Run metadata informs experiment setup.
- Dataset root → Test runner: loads · Offline trajectories are consumed by experiment scripts.
- Dataset root → Run t2: loads · Offline trajectories are consumed by experiment scripts.
- Dataset root → Run t4: loads · Offline trajectories are consumed by experiment scripts.
- Dataset root → Run t5: loads · Offline trajectories are consumed by experiment scripts.
- Dataset root → Run t6: loads · Offline trajectories are consumed by experiment scripts.
- Test runner → Utils: uses · Shared preprocessing and training helpers.
- Run t2 → Utils: uses · Shared preprocessing and training helpers.
- Run t4 → Utils: uses · Shared preprocessing and training helpers.
- Run t5 → Utils: uses · Shared preprocessing and training helpers.
- Run t6 → Utils: uses · Shared preprocessing and training helpers.
- Test runner → VGP model: trains · Evaluation or training entry point for the GP model layer.
- Test runner → VSVGP model: trains · Evaluation or training entry point for the GP model layer.
- Test runner → QSVGP model: trains · Evaluation or training entry point for the GP model layer.
- Run t2 → VGP model: trains · Experiment drivers instantiate GP variants.
- Run t2 → VSVGP model: trains · Experiment drivers instantiate GP variants.
- Run t2 → QSVGP model: trains · Experiment drivers instantiate GP variants.
- Run t4 → VGP model: trains · Experiment drivers instantiate GP variants.
- Run t4 → VSVGP model: trains · Experiment drivers instantiate GP variants.
- Run t4 → QSVGP model: trains · Experiment drivers instantiate GP variants.
- Maze viz → Viz utils: uses · Visualization-specific helper routines.
- Maze viz → Dataset root: inspects · Plots maze dataset coverage and trajectories.
- VGP model → Saved runs: writes · Model checkpoints and outputs are persisted per run.
- VSVGP model → Saved runs: writes · Model checkpoints and outputs are persisted per run.
- QSVGP model → Saved runs: writes · Model checkpoints and outputs are persisted per run.
- Test runner → Saved runs: reads/writes · Experiment scripts consume and emit saved artifacts.
- Run t2 → Saved runs: reads/writes · Experiment scripts consume and emit saved artifacts.
- Run t4 → Saved runs: reads/writes · Experiment scripts consume and emit saved artifacts.
- Run t5 → Saved runs: reads/writes · Experiment scripts consume and emit saved artifacts.
- Run t6 → Saved runs: reads/writes · Experiment scripts consume and emit saved artifacts.
