# lixixibj/deepvarwt-data-code architecture

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

- Interactive diagram: https://gitdiagram.com/lixixibj/deepvarwt-data-code
- Repository: https://github.com/lixixibj/deepvarwt-data-code

## Overview

DeepVARwT is a research codebase for estimating trends and VAR dependence jointly with an LSTM, then forecasting simulated and real multivariate time series. The primary user workflow runs a study or dataset-specific prediction script, fits or loads a model, produces forecasts and evaluates accuracy. The repository also includes DeepAR and DeepState forecasting reproductions. Edges are limited to README statements and shown imports or calls; some dataset-specific wiring is not visible in the excerpts, so those links are omitted.

Main entry points: [`lstm_network.py`](https://github.com/lixixibj/deepvarwt-data-code/blob/main/lstm_network.py) (LSTM VAR Model), [`_main_make_predictions_for_first_macro_data.py`](https://github.com/lixixibj/deepvarwt-data-code/blob/main/_main_make_predictions_for_first_macro_data.py) (Macro Forecasts 1), [`_main_make_predictions_for_climate_p.py`](https://github.com/lixixibj/deepvarwt-data-code/blob/main/_main_make_predictions_for_climate_p.py) (Climate Forecasts), [`_main_make_predictions_for_second_usmacro_data_bvarsv.py`](https://github.com/lixixibj/deepvarwt-data-code/blob/main/_main_make_predictions_for_second_usmacro_data_bvarsv.py) (Macro Forecasts 2)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_estimation["DeepVARwT Estimation"]
  node_simulation["Simulation Runs"]
  node_realfit["Real-Data Fitting"]
  node_network["LSTM VAR Model<br/>[lstm_network.py]"]
  node_likelihood["VAR Likelihood<br/>[custom_loss.py]"]
end

subgraph group_forecasting["Forecasting Applications"]
  node_macro1["Macro Forecasts 1"]
  node_climate["Climate Forecasts"]
  node_macro2["Macro Forecasts 2"]
  node_realdata["Real Datasets"]
end

subgraph group_benchmarks["Forecasting Baselines"]
  node_ar_endog["DeepAR Endogenous"]
  node_ar_macro["DeepAR Macro"]
  node_state_endog["DeepState Endogenous"]
  node_state_macro["DeepState Macro"]
end

subgraph group_analysis["Evaluation and Utilities"]
  node_accuracy["Forecast Metrics"]
  node_accuracy_baselines["Baseline Metrics"]
  node_causality["Causality Transform<br/>[check_causality.py]"]
  node_inverse["Inverse Transform"]
  node_seeding["Seed Control<br/>[seed.py]"]
end

node_user(("Researcher"))

node_user -->|"runs"| node_simulation
node_user -->|"runs"| node_macro1
node_user -->|"runs"| node_climate
node_user -->|"runs"| node_macro2
node_simulation -->|"trains"| node_network
node_simulation -->|"evaluates"| node_likelihood
node_realfit -->|"trains"| node_network
node_realfit -->|"evaluates"| node_likelihood
node_macro1 -->|"fits model"| node_realfit
node_climate -->|"fits model"| node_realfit
node_macro2 -->|"fits model"| node_realfit
node_macro1 -->|"forecasts with"| node_network
node_climate -->|"forecasts with"| node_network
node_macro2 -->|"forecasts with"| node_network
node_macro1 -->|"scores with"| node_accuracy
node_climate -->|"scores with"| node_accuracy
node_macro2 -->|"scores with"| node_accuracy
node_macro1 -->|"sets seeds"| node_seeding
node_climate -->|"sets seeds"| node_seeding
node_macro2 -->|"sets seeds"| node_seeding
node_network -->|"uses transform"| node_inverse
node_user -.->|"runs baseline"| node_ar_endog
node_user -.->|"runs baseline"| node_ar_macro
node_user -.->|"runs baseline"| node_state_endog
node_user -.->|"runs baseline"| node_state_macro
node_ar_endog -->|"scores with"| node_accuracy_baselines
node_ar_macro -->|"scores with"| node_accuracy_baselines
node_state_endog -->|"scores with"| node_accuracy_baselines
node_state_macro -->|"scores with"| node_accuracy_baselines

click node_simulation "https://github.com/lixixibj/deepvarwt-data-code/blob/main/_main_for_para_estimation_parallel.py"
click node_realfit "https://github.com/lixixibj/deepvarwt-data-code/blob/main/_model_fitting_for_real_data.py"
click node_network "https://github.com/lixixibj/deepvarwt-data-code/blob/main/lstm_network.py"
click node_likelihood "https://github.com/lixixibj/deepvarwt-data-code/blob/main/custom_loss.py"
click node_macro1 "https://github.com/lixixibj/deepvarwt-data-code/blob/main/_main_make_predictions_for_first_macro_data.py"
click node_climate "https://github.com/lixixibj/deepvarwt-data-code/blob/main/_main_make_predictions_for_climate_p.py"
click node_macro2 "https://github.com/lixixibj/deepvarwt-data-code/blob/main/_main_make_predictions_for_second_usmacro_data_bvarsv.py"
click node_realdata "https://github.com/lixixibj/deepvarwt-data-code/tree/main/real-data"
click node_ar_endog "https://github.com/lixixibj/deepvarwt-data-code/blob/main/deepAR-deepstate/deepAR_many_times_endog_latest.py"
click node_ar_macro "https://github.com/lixixibj/deepvarwt-data-code/blob/main/deepAR-deepstate/deepAR_many_times_usmacro_bvarsv_latest.py"
click node_state_endog "https://github.com/lixixibj/deepvarwt-data-code/blob/main/deepAR-deepstate/deepState_many_times_endog_latest.py"
click node_state_macro "https://github.com/lixixibj/deepvarwt-data-code/blob/main/deepAR-deepstate/deepState_many_times_usmacro_bvarsv_latest.py"
click node_accuracy "https://github.com/lixixibj/deepvarwt-data-code/blob/main/forecasting_accuracy.py"
click node_accuracy_baselines "https://github.com/lixixibj/deepvarwt-data-code/blob/main/deepAR-deepstate/forecasting_accuracy.py"
click node_causality "https://github.com/lixixibj/deepvarwt-data-code/blob/main/check_causality.py"
click node_inverse "https://github.com/lixixibj/deepvarwt-data-code/blob/main/inverse_transform.py"
click node_seeding "https://github.com/lixixibj/deepvarwt-data-code/blob/main/seed.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_simulation,node_realfit,node_network,node_likelihood toneBlue
class node_macro1,node_climate,node_macro2,node_realdata toneAmber
class node_ar_endog,node_ar_macro,node_state_endog,node_state_macro toneMint
class node_accuracy,node_accuracy_baselines,node_causality,node_inverse,node_seeding toneRose
class node_user toneIndigo
```

## Components

### DeepVARwT Estimation

- [Simulation Runs](https://github.com/lixixibj/deepvarwt-data-code/blob/main/_main_for_para_estimation_parallel.py): `_main_for_para_estimation_parallel.py`
- [Real-Data Fitting](https://github.com/lixixibj/deepvarwt-data-code/blob/main/_model_fitting_for_real_data.py): `_model_fitting_for_real_data.py`
- [LSTM VAR Model](https://github.com/lixixibj/deepvarwt-data-code/blob/main/lstm_network.py): `lstm_network.py`
- [VAR Likelihood](https://github.com/lixixibj/deepvarwt-data-code/blob/main/custom_loss.py): `custom_loss.py`

### Forecasting Applications

- [Macro Forecasts 1](https://github.com/lixixibj/deepvarwt-data-code/blob/main/_main_make_predictions_for_first_macro_data.py): `_main_make_predictions_for_first_macro_data.py`
- [Climate Forecasts](https://github.com/lixixibj/deepvarwt-data-code/blob/main/_main_make_predictions_for_climate_p.py): `_main_make_predictions_for_climate_p.py`
- [Macro Forecasts 2](https://github.com/lixixibj/deepvarwt-data-code/blob/main/_main_make_predictions_for_second_usmacro_data_bvarsv.py): `_main_make_predictions_for_second_usmacro_data_bvarsv.py`
- [Real Datasets](https://github.com/lixixibj/deepvarwt-data-code/tree/main/real-data): `real-data`

### Forecasting Baselines

- [DeepAR Endogenous](https://github.com/lixixibj/deepvarwt-data-code/blob/main/deepAR-deepstate/deepAR_many_times_endog_latest.py): `deepAR-deepstate/deepAR_many_times_endog_latest.py`
- [DeepAR Macro](https://github.com/lixixibj/deepvarwt-data-code/blob/main/deepAR-deepstate/deepAR_many_times_usmacro_bvarsv_latest.py): `deepAR-deepstate/deepAR_many_times_usmacro_bvarsv_latest.py`
- [DeepState Endogenous](https://github.com/lixixibj/deepvarwt-data-code/blob/main/deepAR-deepstate/deepState_many_times_endog_latest.py): `deepAR-deepstate/deepState_many_times_endog_latest.py`
- [DeepState Macro](https://github.com/lixixibj/deepvarwt-data-code/blob/main/deepAR-deepstate/deepState_many_times_usmacro_bvarsv_latest.py): `deepAR-deepstate/deepState_many_times_usmacro_bvarsv_latest.py`

### Evaluation and Utilities

- [Forecast Metrics](https://github.com/lixixibj/deepvarwt-data-code/blob/main/forecasting_accuracy.py): `forecasting_accuracy.py`
- [Baseline Metrics](https://github.com/lixixibj/deepvarwt-data-code/blob/main/deepAR-deepstate/forecasting_accuracy.py): `deepAR-deepstate/forecasting_accuracy.py`
- [Causality Transform](https://github.com/lixixibj/deepvarwt-data-code/blob/main/check_causality.py): `check_causality.py`
- [Inverse Transform](https://github.com/lixixibj/deepvarwt-data-code/blob/main/inverse_transform.py): `inverse_transform.py`
- [Seed Control](https://github.com/lixixibj/deepvarwt-data-code/blob/main/seed.py): `seed.py`

### Other components

- **Researcher**

## Connections

- Researcher → Simulation Runs: runs (evidence: `README.md`)
- Researcher → Macro Forecasts 1: runs (evidence: `README.md`)
- Researcher → Climate Forecasts: runs (evidence: `README.md`)
- Researcher → Macro Forecasts 2: runs (evidence: `README.md`)
- Simulation Runs → LSTM VAR Model: trains (evidence: `_main_for_para_estimation_parallel.py`)
- Simulation Runs → VAR Likelihood: evaluates (evidence: `_main_for_para_estimation_parallel.py`)
- Real-Data Fitting → LSTM VAR Model: trains (evidence: `_model_fitting_for_real_data.py`)
- Real-Data Fitting → VAR Likelihood: evaluates (evidence: `_model_fitting_for_real_data.py`)
- Macro Forecasts 1 → Real-Data Fitting: fits model (evidence: `_main_make_predictions_for_first_macro_data.py`)
- Climate Forecasts → Real-Data Fitting: fits model (evidence: `_main_make_predictions_for_climate_p.py`)
- Macro Forecasts 2 → Real-Data Fitting: fits model (evidence: `_main_make_predictions_for_second_usmacro_data_bvarsv.py`)
- Macro Forecasts 1 → LSTM VAR Model: forecasts with (evidence: `_main_make_predictions_for_first_macro_data.py`)
- Climate Forecasts → LSTM VAR Model: forecasts with (evidence: `_main_make_predictions_for_climate_p.py`)
- Macro Forecasts 2 → LSTM VAR Model: forecasts with (evidence: `_main_make_predictions_for_second_usmacro_data_bvarsv.py`)
- Macro Forecasts 1 → Forecast Metrics: scores with (evidence: `_main_make_predictions_for_first_macro_data.py`)
- Climate Forecasts → Forecast Metrics: scores with (evidence: `_main_make_predictions_for_climate_p.py`)
- Macro Forecasts 2 → Forecast Metrics: scores with (evidence: `_main_make_predictions_for_second_usmacro_data_bvarsv.py`)
- Macro Forecasts 1 → Seed Control: sets seeds (evidence: `_main_make_predictions_for_first_macro_data.py`)
- Climate Forecasts → Seed Control: sets seeds (evidence: `_main_make_predictions_for_climate_p.py`)
- Macro Forecasts 2 → Seed Control: sets seeds (evidence: `_main_make_predictions_for_second_usmacro_data_bvarsv.py`)
- LSTM VAR Model → Inverse Transform: uses transform (evidence: `lstm_network.py`)
- Researcher → DeepAR Endogenous: runs baseline (evidence: `README.md`)
- Researcher → DeepAR Macro: runs baseline (evidence: `README.md`)
- Researcher → DeepState Endogenous: runs baseline (evidence: `README.md`)
- Researcher → DeepState Macro: runs baseline (evidence: `README.md`)
- DeepAR Endogenous → Baseline Metrics: scores with (evidence: `deepAR-deepstate/deepAR_many_times_endog_latest.py`)
- DeepAR Macro → Baseline Metrics: scores with (evidence: `deepAR-deepstate/deepAR_many_times_usmacro_bvarsv_latest.py`)
- DeepState Endogenous → Baseline Metrics: scores with (evidence: `deepAR-deepstate/deepState_many_times_endog_latest.py`)
- DeepState Macro → Baseline Metrics: scores with (evidence: `deepAR-deepstate/deepState_many_times_usmacro_bvarsv_latest.py`)
