# lixixibj/deeptvar-data-code architecture

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

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

## Overview

DeepTVAR is a research implementation for estimating and forecasting time-varying VAR models, with an LSTM generating coefficients and a causality-preserving transformation. Its principal workflows are simulation fitting and real-data forecasting, with benchmark implementations for comparison. The graph also preserves documented plotting, accuracy evaluation, and benchmark branches. Some source is unsampled, so only documented or indexed relationships are linked; benchmark internals beyond the excerpts are represented at their existing directory paths.

Main entry points: [`_main_for_para_estimation.py`](https://github.com/lixixibj/deeptvar-data-code/blob/main/_main_for_para_estimation.py) (Simulation Fitting), [`_main_make_predictions_for_real_data.py`](https://github.com/lixixibj/deeptvar-data-code/blob/main/_main_make_predictions_for_real_data.py) (Real Forecasting), [`_model_fitting_for_real_data.py`](https://github.com/lixixibj/deeptvar-data-code/blob/main/_model_fitting_for_real_data.py) (Model Fitting), [`benchmarks-code-data/DeepAR/DeepAR_EU_3_prices.py`](https://github.com/lixixibj/deeptvar-data-code/blob/main/benchmarks-code-data/DeepAR/DeepAR_EU_3_prices.py) (DeepAR Benchmark)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["DeepTVAR Core"]
  node_lstm["LSTM Parameter Model<br/>[lstm_network.py]"]
  node_loss["VAR Likelihood"]
  node_seed["Seed Control<br/>[seed.py]"]
  node_accuracy["Forecast Metrics"]
end

subgraph group_simulation["Simulation Study"]
  node_simulation_run["Simulation Fitting"]
  node_sim_results[("Simulation Outputs")]
  node_sim_plot["Simulation Summaries"]
end

subgraph group_real["Real Data Forecasting"]
  node_real_run["Real Forecasting"]
  node_real_fit["Model Fitting"]
  node_real_results[("Real Forecast Outputs")]
end

subgraph group_benchmarks["Benchmark Models"]
  node_deepar["DeepAR Benchmark"]
  node_deepstate["DeepState Benchmark"]
  node_qbl["QBLL Benchmark"]
  node_var["VAR Benchmark"]
  node_benchmark_results[("Benchmark Forecasts")]
end

node_researcher(("Researcher"))

node_researcher -->|"runs fitting"| node_simulation_run
node_researcher -->|"runs forecasts"| node_real_run
node_simulation_run -->|"generates parameters"| node_lstm
node_simulation_run -->|"computes likelihood"| node_loss
node_simulation_run -->|"sets randomness"| node_seed
node_simulation_run -->|"saves estimates"| node_sim_results
node_sim_plot -->|"reads runs"| node_sim_results
node_researcher -->|"plots summaries"| node_sim_plot
node_real_run -->|"fits model"| node_real_fit
node_real_fit -->|"constructs network"| node_lstm
node_real_fit -->|"trains against"| node_loss
node_real_fit -->|"sets randomness"| node_seed
node_real_run -->|"calculates metrics"| node_accuracy
node_real_run -->|"saves forecasts"| node_real_results
node_researcher -->|"runs benchmark"| node_deepar
node_researcher -->|"runs benchmark"| node_deepstate
node_deepar -->|"imports metrics"| node_accuracy
node_deepstate -->|"imports metrics"| node_accuracy
node_deepar -->|"writes forecasts"| node_benchmark_results
node_deepstate -->|"writes forecasts"| node_benchmark_results
node_researcher -->|"uses benchmark"| node_qbl
node_researcher -->|"uses benchmark"| node_var

click node_simulation_run "https://github.com/lixixibj/deeptvar-data-code/blob/main/_main_for_para_estimation.py"
click node_real_run "https://github.com/lixixibj/deeptvar-data-code/blob/main/_main_make_predictions_for_real_data.py"
click node_real_fit "https://github.com/lixixibj/deeptvar-data-code/blob/main/_model_fitting_for_real_data.py"
click node_lstm "https://github.com/lixixibj/deeptvar-data-code/blob/main/lstm_network.py"
click node_loss "https://github.com/lixixibj/deeptvar-data-code/blob/main/custom_loss_float.py"
click node_seed "https://github.com/lixixibj/deeptvar-data-code/blob/main/seed.py"
click node_accuracy "https://github.com/lixixibj/deeptvar-data-code/blob/main/forecasting_accuracy.py"
click node_sim_results "https://github.com/lixixibj/deeptvar-data-code/tree/main/simulation-res/res"
click node_sim_plot "https://github.com/lixixibj/deeptvar-data-code/blob/main/quick_plot_simu_res.py"
click node_real_results "https://github.com/lixixibj/deeptvar-data-code/tree/main/real-data-forecasting-res"
click node_deepar "https://github.com/lixixibj/deeptvar-data-code/blob/main/benchmarks-code-data/DeepAR/DeepAR_EU_3_prices.py"
click node_deepstate "https://github.com/lixixibj/deeptvar-data-code/blob/main/benchmarks-code-data/DeepState/DeepState_EU_3_prices.py"
click node_qbl "https://github.com/lixixibj/deeptvar-data-code/tree/main/benchmarks-code-data/QBLL"
click node_var "https://github.com/lixixibj/deeptvar-data-code/tree/main/benchmarks-code-data/VAR"
click node_benchmark_results "https://github.com/lixixibj/deeptvar-data-code/tree/main/benchmarks-code-data"

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_lstm,node_loss,node_seed,node_accuracy toneBlue
class node_simulation_run,node_sim_results,node_sim_plot toneAmber
class node_real_run,node_real_fit,node_real_results toneMint
class node_deepar,node_deepstate,node_qbl,node_var,node_benchmark_results toneRose
class node_researcher toneIndigo
```

## Components

### DeepTVAR Core

- [LSTM Parameter Model](https://github.com/lixixibj/deeptvar-data-code/blob/main/lstm_network.py): `lstm_network.py`
- [VAR Likelihood](https://github.com/lixixibj/deeptvar-data-code/blob/main/custom_loss_float.py): `custom_loss_float.py`
- [Seed Control](https://github.com/lixixibj/deeptvar-data-code/blob/main/seed.py): `seed.py`
- [Forecast Metrics](https://github.com/lixixibj/deeptvar-data-code/blob/main/forecasting_accuracy.py): `forecasting_accuracy.py`

### Simulation Study

- [Simulation Fitting](https://github.com/lixixibj/deeptvar-data-code/blob/main/_main_for_para_estimation.py): `_main_for_para_estimation.py`
- [Simulation Outputs](https://github.com/lixixibj/deeptvar-data-code/tree/main/simulation-res/res): `simulation-res/res`
- [Simulation Summaries](https://github.com/lixixibj/deeptvar-data-code/blob/main/quick_plot_simu_res.py): `quick_plot_simu_res.py`

### Real Data Forecasting

- [Real Forecasting](https://github.com/lixixibj/deeptvar-data-code/blob/main/_main_make_predictions_for_real_data.py): `_main_make_predictions_for_real_data.py`
- [Model Fitting](https://github.com/lixixibj/deeptvar-data-code/blob/main/_model_fitting_for_real_data.py): `_model_fitting_for_real_data.py`
- [Real Forecast Outputs](https://github.com/lixixibj/deeptvar-data-code/tree/main/real-data-forecasting-res): `real-data-forecasting-res`

### Benchmark Models

- [DeepAR Benchmark](https://github.com/lixixibj/deeptvar-data-code/blob/main/benchmarks-code-data/DeepAR/DeepAR_EU_3_prices.py): `benchmarks-code-data/DeepAR/DeepAR_EU_3_prices.py`
- [DeepState Benchmark](https://github.com/lixixibj/deeptvar-data-code/blob/main/benchmarks-code-data/DeepState/DeepState_EU_3_prices.py): `benchmarks-code-data/DeepState/DeepState_EU_3_prices.py`
- [QBLL Benchmark](https://github.com/lixixibj/deeptvar-data-code/tree/main/benchmarks-code-data/QBLL): `benchmarks-code-data/QBLL`
- [VAR Benchmark](https://github.com/lixixibj/deeptvar-data-code/tree/main/benchmarks-code-data/VAR): `benchmarks-code-data/VAR`
- [Benchmark Forecasts](https://github.com/lixixibj/deeptvar-data-code/tree/main/benchmarks-code-data): `benchmarks-code-data`

### Other components

- **Researcher**

## Connections

- Researcher → Simulation Fitting: runs fitting (evidence: `README.md`)
- Researcher → Real Forecasting: runs forecasts (evidence: `README.md`)
- Simulation Fitting → LSTM Parameter Model: generates parameters (evidence: `_main_for_para_estimation.py`)
- Simulation Fitting → VAR Likelihood: computes likelihood (evidence: `_main_for_para_estimation.py`)
- Simulation Fitting → Seed Control: sets randomness (evidence: `_main_for_para_estimation.py`)
- Simulation Fitting → Simulation Outputs: saves estimates (evidence: `README.md`)
- Simulation Summaries → Simulation Outputs: reads runs (evidence: `README.md`)
- Researcher → Simulation Summaries: plots summaries (evidence: `README.md`)
- Real Forecasting → Model Fitting: fits model (evidence: `_main_make_predictions_for_real_data.py`)
- Model Fitting → LSTM Parameter Model: constructs network (evidence: `_model_fitting_for_real_data.py`)
- Model Fitting → VAR Likelihood: trains against (evidence: `_model_fitting_for_real_data.py`)
- Model Fitting → Seed Control: sets randomness (evidence: `_model_fitting_for_real_data.py`)
- Real Forecasting → Forecast Metrics: calculates metrics (evidence: `_main_make_predictions_for_real_data.py`)
- Real Forecasting → Real Forecast Outputs: saves forecasts (evidence: `README.md`)
- Researcher → DeepAR Benchmark: runs benchmark (evidence: `README.md`)
- Researcher → DeepState Benchmark: runs benchmark (evidence: `README.md`)
- DeepAR Benchmark → Forecast Metrics: imports metrics (evidence: `benchmarks-code-data/DeepAR/DeepAR_EU_3_prices.py`)
- DeepState Benchmark → Forecast Metrics: imports metrics (evidence: `benchmarks-code-data/DeepState/DeepState_EU_3_prices.py`)
- DeepAR Benchmark → Benchmark Forecasts: writes forecasts (evidence: `benchmarks-code-data/DeepAR/DeepAR_EU_3_prices.py`)
- DeepState Benchmark → Benchmark Forecasts: writes forecasts (evidence: `benchmarks-code-data/DeepState/DeepState_EU_3_prices.py`)
- Researcher → QBLL Benchmark: uses benchmark (evidence: `README.md`)
- Researcher → VAR Benchmark: uses benchmark (evidence: `README.md`)
