# daxin007/armd architecture

> Architecture diagram of the GitHub repository daxin007/armd, 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/daxin007/armd
- Repository: https://github.com/daxin007/armd

## Overview

This repository trains and samples an autoregressive moving-diffusion model for time-series forecasting. The principal workflow starts with a user-selected YAML configuration, builds windowed data, instantiates the model, trains it, then constructs a prediction dataset and samples forecasts for MSE/MAE reporting. Dataset preprocessing and diffusion-network internals form supporting layers. The README also documents configurable dataset scenarios; the tree includes masking/imputation and synthetic-data evaluation utilities. Several utility modules are present but their runtime callers are not shown, so no connections to the main workflow are inferred.

Main entry points: [`main.py`](https://github.com/daxin007/armd/blob/main/main.py) (Experiment entry), [`engine/solver.py`](https://github.com/daxin007/armd/blob/main/engine/solver.py) (Trainer), [`Data/build_dataloader.py`](https://github.com/daxin007/armd/blob/main/Data/build_dataloader.py) (Loader builder), [`Utils/Data_utils/real_datasets.py`](https://github.com/daxin007/armd/blob/main/Utils/Data_utils/real_datasets.py) (Windowed datasets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Forecast workflow"]
  node_main["Experiment entry<br/>[main.py]"]
  node_configs["Dataset configs"]
  node_trainer["Trainer<br/>[solver.py]"]
  node_run_store[("Run checkpoints<br/>[solver.py]")]
  node_io_utils["Config utilities<br/>[io_utils.py]"]
end

subgraph group_data["Data preparation"]
  node_loader_builder["Loader builder"]
  node_dataset["Windowed datasets<br/>[real_datasets.py]"]
  node_raw_data["Dataset files"]
  node_masking["Masking utilities<br/>[masking_utils.py]"]
  node_data_loader["Data loader utilities<br/>[data_loader.py]"]
end

subgraph group_model["Diffusion model"]
  node_armd["ARMD diffusion<br/>[armd.py]"]
  node_linear["Linear denoiser<br/>[linear.py]"]
  node_model_utils["Model components<br/>[model_utils.py]"]
end

subgraph group_evaluation["Evaluation utilities"]
  node_metric_utils["Metric helpers<br/>[metric_utils.py]"]
  node_discriminative["Discriminative score"]
  node_predictive["Predictive score"]
  node_context_fid["Context FID<br/>[context_fid.py]"]
  node_cross_correlation["Cross correlation"]
  node_imputation["Imputation utilities"]
end

node_user(("Experiment user"))

node_user -->|"runs"| node_main
node_main -->|"loads options"| node_configs
node_main -->|"loads config"| node_io_utils
node_main -->|"builds loaders"| node_loader_builder
node_loader_builder -->|"instantiates dataset"| node_io_utils
node_loader_builder -.->|"instantiates"| node_dataset
node_dataset -.->|"reads time series"| node_raw_data
node_dataset -->|"uses masks"| node_masking
node_main -.->|"instantiates model"| node_armd
node_armd -->|"uses denoiser"| node_linear
node_linear -->|"uses components"| node_model_utils
node_main -->|"creates trainer"| node_trainer
node_trainer -.->|"trains and samples"| node_armd
node_trainer -->|"saves checkpoints"| node_run_store
node_main -->|"trains and forecasts"| node_trainer
node_discriminative -->|"uses helpers"| node_metric_utils
node_predictive -->|"uses helpers"| node_metric_utils

click node_main "https://github.com/daxin007/armd/blob/main/main.py"
click node_configs "https://github.com/daxin007/armd/tree/main/Config"
click node_trainer "https://github.com/daxin007/armd/blob/main/engine/solver.py"
click node_run_store "https://github.com/daxin007/armd/blob/main/engine/solver.py"
click node_loader_builder "https://github.com/daxin007/armd/blob/main/Data/build_dataloader.py"
click node_dataset "https://github.com/daxin007/armd/blob/main/Utils/Data_utils/real_datasets.py"
click node_raw_data "https://github.com/daxin007/armd/tree/main/Data/datasets"
click node_masking "https://github.com/daxin007/armd/blob/main/Utils/masking_utils.py"
click node_data_loader "https://github.com/daxin007/armd/blob/main/Utils/Data_utils/data_loader.py"
click node_armd "https://github.com/daxin007/armd/blob/main/Models/autoregressive_diffusion/armd.py"
click node_linear "https://github.com/daxin007/armd/blob/main/Models/autoregressive_diffusion/linear.py"
click node_model_utils "https://github.com/daxin007/armd/blob/main/Models/autoregressive_diffusion/model_utils.py"
click node_io_utils "https://github.com/daxin007/armd/blob/main/Utils/io_utils.py"
click node_metric_utils "https://github.com/daxin007/armd/blob/main/Utils/metric_utils.py"
click node_discriminative "https://github.com/daxin007/armd/blob/main/Utils/discriminative_metric.py"
click node_predictive "https://github.com/daxin007/armd/blob/main/Utils/predictive_metric.py"
click node_context_fid "https://github.com/daxin007/armd/blob/main/Utils/context_fid.py"
click node_cross_correlation "https://github.com/daxin007/armd/blob/main/Utils/cross_correlation.py"
click node_imputation "https://github.com/daxin007/armd/blob/main/Utils/imputation_utils.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_main,node_configs,node_trainer,node_run_store,node_io_utils,node_user toneBlue
class node_loader_builder,node_dataset,node_raw_data,node_masking,node_data_loader toneAmber
class node_armd,node_linear,node_model_utils toneMint
class node_metric_utils,node_discriminative,node_predictive,node_context_fid,node_cross_correlation,node_imputation toneRose
```

## Components

### Forecast workflow

- [Experiment entry](https://github.com/daxin007/armd/blob/main/main.py): `main.py`
- [Dataset configs](https://github.com/daxin007/armd/tree/main/Config): `Config`
- [Trainer](https://github.com/daxin007/armd/blob/main/engine/solver.py): `engine/solver.py`
- [Run checkpoints](https://github.com/daxin007/armd/blob/main/engine/solver.py): `engine/solver.py`
- [Config utilities](https://github.com/daxin007/armd/blob/main/Utils/io_utils.py): `Utils/io_utils.py`

### Data preparation

- [Loader builder](https://github.com/daxin007/armd/blob/main/Data/build_dataloader.py): `Data/build_dataloader.py`
- [Windowed datasets](https://github.com/daxin007/armd/blob/main/Utils/Data_utils/real_datasets.py): `Utils/Data_utils/real_datasets.py`
- [Dataset files](https://github.com/daxin007/armd/tree/main/Data/datasets): `Data/datasets`
- [Masking utilities](https://github.com/daxin007/armd/blob/main/Utils/masking_utils.py): `Utils/masking_utils.py`
- [Data loader utilities](https://github.com/daxin007/armd/blob/main/Utils/Data_utils/data_loader.py): `Utils/Data_utils/data_loader.py`

### Diffusion model

- [ARMD diffusion](https://github.com/daxin007/armd/blob/main/Models/autoregressive_diffusion/armd.py): `Models/autoregressive_diffusion/armd.py`
- [Linear denoiser](https://github.com/daxin007/armd/blob/main/Models/autoregressive_diffusion/linear.py): `Models/autoregressive_diffusion/linear.py`
- [Model components](https://github.com/daxin007/armd/blob/main/Models/autoregressive_diffusion/model_utils.py): `Models/autoregressive_diffusion/model_utils.py`

### Evaluation utilities

- [Metric helpers](https://github.com/daxin007/armd/blob/main/Utils/metric_utils.py): `Utils/metric_utils.py`
- [Discriminative score](https://github.com/daxin007/armd/blob/main/Utils/discriminative_metric.py): `Utils/discriminative_metric.py`
- [Predictive score](https://github.com/daxin007/armd/blob/main/Utils/predictive_metric.py): `Utils/predictive_metric.py`
- [Context FID](https://github.com/daxin007/armd/blob/main/Utils/context_fid.py): `Utils/context_fid.py`
- [Cross correlation](https://github.com/daxin007/armd/blob/main/Utils/cross_correlation.py): `Utils/cross_correlation.py`
- [Imputation utilities](https://github.com/daxin007/armd/blob/main/Utils/imputation_utils.py): `Utils/imputation_utils.py`

### Other components

- **Experiment user**

## Connections

- Experiment user → Experiment entry: runs (evidence: `README.md`)
- Experiment entry → Dataset configs: loads options (evidence: `main.py`)
- Experiment entry → Config utilities: loads config (evidence: `main.py`)
- Experiment entry → Loader builder: builds loaders (evidence: `main.py`)
- Loader builder → Config utilities: instantiates dataset (evidence: `Data/build_dataloader.py`)
- Loader builder → Windowed datasets: instantiates
- Windowed datasets → Dataset files: reads time series
- Windowed datasets → Masking utilities: uses masks (evidence: `Utils/Data_utils/real_datasets.py`)
- Experiment entry → ARMD diffusion: instantiates model
- ARMD diffusion → Linear denoiser: uses denoiser (evidence: `Models/autoregressive_diffusion/armd.py`)
- Linear denoiser → Model components: uses components (evidence: `Models/autoregressive_diffusion/linear.py`)
- Experiment entry → Trainer: creates trainer (evidence: `main.py`)
- Trainer → ARMD diffusion: trains and samples
- Trainer → Run checkpoints: saves checkpoints (evidence: `engine/solver.py`)
- Experiment entry → Trainer: trains and forecasts (evidence: `main.py`)
- Discriminative score → Metric helpers: uses helpers (evidence: `Utils/discriminative_metric.py`)
- Predictive score → Metric helpers: uses helpers (evidence: `Utils/predictive_metric.py`)
