# pardhuvarmax/lbsm-research architecture

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

- Interactive diagram: https://gitdiagram.com/pardhuvarmax/lbsm-research
- Repository: https://github.com/pardhuvarmax/lbsm-research

## Overview

LBSM is a research framework for studying latent behavioral structure in adaptive systems, currently using synthetic reinforcement-guided agents. Its principal workflow is to generate regime-labeled telemetry, process it for analysis, then examine manifolds, infer hidden states, detect drift, and evaluate adaptive behavior. The README also highlights statistical observability, robustness experiments, and visual analysis. Some relationships are supported only by module references or the documented research workflow; those are marked dashed with no evidence path rather than presented as verified calls.

Main entry points: [`experiments`](https://github.com/pardhuvarmax/lbsm-research/tree/main/experiments) (Experiment Runners), [`src/telemetry`](https://github.com/pardhuvarmax/lbsm-research/tree/main/src/telemetry) (Telemetry Processing), [`src/rl/adaptation_dynamics.py`](https://github.com/pardhuvarmax/lbsm-research/blob/main/src/rl/adaptation_dynamics.py) (Adaptation Dynamics), [`src/simulation/agent.py`](https://github.com/pardhuvarmax/lbsm-research/blob/main/src/simulation/agent.py) (Latent Agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Agent Simulation"]
  node_profiles["Behavior Profiles"]
  node_agent["Latent Agent<br/>[agent.py]"]
  node_generator["Telemetry Generator"]
end

subgraph group_analysis["Telemetry Analysis"]
  node_telemetry["Telemetry Processing"]
  node_statistics["Telemetry Statistics<br/>[statistics.py]"]
  node_manifold["Manifold Analysis"]
  node_umap["UMAP Projection<br/>[umap_projection.py]"]
  node_geometry["Trajectory Geometry"]
  node_manifold_metrics["Manifold Metrics"]
  node_hmm["Hidden-State Inference"]
  node_hidden_model["Hidden-State Model"]
  node_drift["Drift Detection<br/>[drift_detection.py]"]
  node_kl["KL Divergence<br/>[kl_divergence.py]"]
  node_regime_shift["Regime Shift Analysis"]
  node_evaluation["Evaluation Metrics"]
end

subgraph group_learning["Adaptive Learning"]
  node_rl_env["Behavioral Environment<br/>[environment.py]"]
  node_qlearning["Q-Learning<br/>[q_learning.py]"]
  node_adaptation["Adaptation Dynamics"]
  node_reward["Reward Dynamics<br/>[reward_dynamics.py]"]
end

subgraph group_research["Research Outputs"]
  node_experiments["Experiment Runners"]
  node_visualization["Visualization"]
  node_tracking["Run Tracking"]
  node_io["Artifact I/O<br/>[io.py]"]
end

node_researcher(("Researcher"))

node_agent -->|"uses profiles"| node_profiles
node_qlearning -->|"uses environment"| node_rl_env
node_adaptation -->|"uses profiles"| node_profiles
node_adaptation -.->|"uses tracking"| node_reward
node_tracking -->|"saves records"| node_io
node_researcher -.->|"runs experiments"| node_experiments
node_experiments -.->|"generates telemetry"| node_agent
node_generator -.->|"provides observations"| node_telemetry
node_telemetry -.->|"supports embedding"| node_manifold
node_telemetry -.->|"supports inference"| node_hmm
node_telemetry -.->|"supports detection"| node_drift
node_manifold -.->|"assesses structure"| node_evaluation
node_experiments -.->|"produces analyses"| node_visualization
node_experiments -->|"tracks runs"| node_tracking
node_experiments -->|"writes artifacts"| node_io

click node_profiles "https://github.com/pardhuvarmax/lbsm-research/blob/main/src/simulation/behavior_profiles.py"
click node_agent "https://github.com/pardhuvarmax/lbsm-research/blob/main/src/simulation/agent.py"
click node_generator "https://github.com/pardhuvarmax/lbsm-research/blob/main/src/simulation/telemetry_generator.py"
click node_telemetry "https://github.com/pardhuvarmax/lbsm-research/tree/main/src/telemetry"
click node_statistics "https://github.com/pardhuvarmax/lbsm-research/blob/main/src/telemetry/statistics.py"
click node_manifold "https://github.com/pardhuvarmax/lbsm-research/tree/main/src/manifold"
click node_umap "https://github.com/pardhuvarmax/lbsm-research/blob/main/src/manifold/umap_projection.py"
click node_geometry "https://github.com/pardhuvarmax/lbsm-research/blob/main/src/manifold/trajectory_geometry.py"
click node_manifold_metrics "https://github.com/pardhuvarmax/lbsm-research/blob/main/src/manifold/manifold_metrics.py"
click node_hmm "https://github.com/pardhuvarmax/lbsm-research/tree/main/src/hmm"
click node_hidden_model "https://github.com/pardhuvarmax/lbsm-research/blob/main/src/hmm/hidden_state_model.py"
click node_drift "https://github.com/pardhuvarmax/lbsm-research/blob/main/src/drift/drift_detection.py"
click node_kl "https://github.com/pardhuvarmax/lbsm-research/blob/main/src/drift/kl_divergence.py"
click node_regime_shift "https://github.com/pardhuvarmax/lbsm-research/blob/main/src/drift/regime_shift_analysis.py"
click node_evaluation "https://github.com/pardhuvarmax/lbsm-research/tree/main/src/evaluation"
click node_rl_env "https://github.com/pardhuvarmax/lbsm-research/blob/main/src/rl/environment.py"
click node_qlearning "https://github.com/pardhuvarmax/lbsm-research/blob/main/src/rl/q_learning.py"
click node_adaptation "https://github.com/pardhuvarmax/lbsm-research/blob/main/src/rl/adaptation_dynamics.py"
click node_reward "https://github.com/pardhuvarmax/lbsm-research/blob/main/src/rl/reward_dynamics.py"
click node_experiments "https://github.com/pardhuvarmax/lbsm-research/tree/main/experiments"
click node_visualization "https://github.com/pardhuvarmax/lbsm-research/tree/main/src/visualization"
click node_tracking "https://github.com/pardhuvarmax/lbsm-research/blob/main/src/utils/experiment_tracking.py"
click node_io "https://github.com/pardhuvarmax/lbsm-research/blob/main/src/utils/io.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_profiles,node_agent,node_generator toneBlue
class node_telemetry,node_statistics,node_manifold,node_umap,node_geometry,node_manifold_metrics,node_hmm,node_hidden_model,node_drift,node_kl,node_regime_shift,node_evaluation toneAmber
class node_rl_env,node_qlearning,node_adaptation,node_reward toneMint
class node_experiments,node_visualization,node_tracking,node_io toneRose
class node_researcher toneIndigo
```

## Components

### Agent Simulation

- [Behavior Profiles](https://github.com/pardhuvarmax/lbsm-research/blob/main/src/simulation/behavior_profiles.py): `src/simulation/behavior_profiles.py`
- [Latent Agent](https://github.com/pardhuvarmax/lbsm-research/blob/main/src/simulation/agent.py): `src/simulation/agent.py`
- [Telemetry Generator](https://github.com/pardhuvarmax/lbsm-research/blob/main/src/simulation/telemetry_generator.py): `src/simulation/telemetry_generator.py`

### Telemetry Analysis

- [Telemetry Processing](https://github.com/pardhuvarmax/lbsm-research/tree/main/src/telemetry): `src/telemetry`
- [Telemetry Statistics](https://github.com/pardhuvarmax/lbsm-research/blob/main/src/telemetry/statistics.py): `src/telemetry/statistics.py`
- [Manifold Analysis](https://github.com/pardhuvarmax/lbsm-research/tree/main/src/manifold): `src/manifold`
- [UMAP Projection](https://github.com/pardhuvarmax/lbsm-research/blob/main/src/manifold/umap_projection.py): `src/manifold/umap_projection.py`
- [Trajectory Geometry](https://github.com/pardhuvarmax/lbsm-research/blob/main/src/manifold/trajectory_geometry.py): `src/manifold/trajectory_geometry.py`
- [Manifold Metrics](https://github.com/pardhuvarmax/lbsm-research/blob/main/src/manifold/manifold_metrics.py): `src/manifold/manifold_metrics.py`
- [Hidden-State Inference](https://github.com/pardhuvarmax/lbsm-research/tree/main/src/hmm): `src/hmm`
- [Hidden-State Model](https://github.com/pardhuvarmax/lbsm-research/blob/main/src/hmm/hidden_state_model.py): `src/hmm/hidden_state_model.py`
- [Drift Detection](https://github.com/pardhuvarmax/lbsm-research/blob/main/src/drift/drift_detection.py): `src/drift/drift_detection.py`
- [KL Divergence](https://github.com/pardhuvarmax/lbsm-research/blob/main/src/drift/kl_divergence.py): `src/drift/kl_divergence.py`
- [Regime Shift Analysis](https://github.com/pardhuvarmax/lbsm-research/blob/main/src/drift/regime_shift_analysis.py): `src/drift/regime_shift_analysis.py`
- [Evaluation Metrics](https://github.com/pardhuvarmax/lbsm-research/tree/main/src/evaluation): `src/evaluation`

### Adaptive Learning

- [Behavioral Environment](https://github.com/pardhuvarmax/lbsm-research/blob/main/src/rl/environment.py): `src/rl/environment.py`
- [Q-Learning](https://github.com/pardhuvarmax/lbsm-research/blob/main/src/rl/q_learning.py): `src/rl/q_learning.py`
- [Adaptation Dynamics](https://github.com/pardhuvarmax/lbsm-research/blob/main/src/rl/adaptation_dynamics.py): `src/rl/adaptation_dynamics.py`
- [Reward Dynamics](https://github.com/pardhuvarmax/lbsm-research/blob/main/src/rl/reward_dynamics.py): `src/rl/reward_dynamics.py`

### Research Outputs

- [Experiment Runners](https://github.com/pardhuvarmax/lbsm-research/tree/main/experiments): `experiments`
- [Visualization](https://github.com/pardhuvarmax/lbsm-research/tree/main/src/visualization): `src/visualization`
- [Run Tracking](https://github.com/pardhuvarmax/lbsm-research/blob/main/src/utils/experiment_tracking.py): `src/utils/experiment_tracking.py`
- [Artifact I/O](https://github.com/pardhuvarmax/lbsm-research/blob/main/src/utils/io.py): `src/utils/io.py`

### Other components

- **Researcher**

## Connections

- Latent Agent → Behavior Profiles: uses profiles (evidence: `src/simulation/agent.py`)
- Q-Learning → Behavioral Environment: uses environment (evidence: `src/rl/q_learning.py`)
- Adaptation Dynamics → Behavior Profiles: uses profiles (evidence: `src/rl/adaptation_dynamics.py`)
- Adaptation Dynamics → Reward Dynamics: uses tracking
- Run Tracking → Artifact I/O: saves records (evidence: `src/utils/experiment_tracking.py`)
- Researcher → Experiment Runners: runs experiments
- Experiment Runners → Latent Agent: generates telemetry
- Telemetry Generator → Telemetry Processing: provides observations
- Telemetry Processing → Manifold Analysis: supports embedding
- Telemetry Processing → Hidden-State Inference: supports inference (evidence: `src/hmm/robust_fitting.py`)
- Telemetry Processing → Drift Detection: supports detection
- Manifold Analysis → Evaluation Metrics: assesses structure
- Experiment Runners → Visualization: produces analyses
- Experiment Runners → Run Tracking: tracks runs (evidence: `experiments/rl_adaptive/run_rl_experiment.py`)
- Experiment Runners → Artifact I/O: writes artifacts (evidence: `experiments/rl_adaptive/run_rl_experiment.py`)
