Skip to content
/ TCS Public
forked from gkorgkolis/TCS

Code for the paper "Temporal Causal-based Simulation for Realistic Time-series Generation".

License

Notifications You must be signed in to change notification settings

kougioulis/TCS

 
 

Repository files navigation

Temporal Causal-based Simulation (TCS)

Python 3.10 PyTorch Scikit-learn License arXiv CodeFactor

Code for the paper "Temporal Causal-based Simulation for Realistic Time-series Generation", Gkorgkolis et al., 2025.

📌 Overview

  • Problem: Existing works on generating time-series data together with their causal graphs often operate under overly simplistic or closed-world simulation assumptions. More critically, the quality of generated data is commonly assessed using a single, fixed, and unoptimized discrepancy measure, such as a particular instantiation of a Classifier Two-Sample Test (C2ST) or kernel-based metric (e.g., MMD). The arbitrary selection of a discriminator and its hyperparameters can severely bias evaluation outcomes and fail to reflect fidelity of data quality.

  • Contributions:

    • Demonstrate that relying on unoptimized metrics and classifier two-sample tests (C2ST) for data quality assessment leads to unreliable conclusions on data quality (see Figure 1).
    • Introduce Temporal Causal-based Simulation (TCS), a modular, model-agnostic generative pipeline for learning temporal structural causal models and simulating realistic time-series data together with their time-lagged causal graphs. In contrast to previous works, TCS directly learns causal models from real data samples, allowing generation of not only observational data but also interventions, counterfactual reasoning and modeling of causal digital twins from data as well.
    • Propose a Min-max AutoML scheme that selects the best simulation configuration using optimized C2STs (discriminators), by minimizing over configurations $c \in C$ and maximizing over discriminators $d \in D$ (illustrated in the main figure). This step serves as a causal model tuning phase, which we call Adversarial Causal Tuning - ACT.
    • Design TCS as an extensible software framework, enabling easy integration of additional causal discovery algorithms, functional dependence estimators, and noise distribution models.
    • Show that our method achieves comparable or superior generation across a diverse set of real, semi-synthetic, and synthetic time-series datasets under optimized discriminator selection.

Note: TCS does not depend on ACT to function as a generative causal model simulator: Any TSCM produced by the pipeline can already be used to generate data and perform causal inference. ACT is introduced solely as a tuning echanism for selecting among multiple candidate causal models.

Installation

🐍 Using Conda

Create a virtual conda environment using

  • conda env create -f environment.yaml
  • conda activate TCS

Install requirements directly

Alternatively, you can just install the dependencies from the requirements.txt file, either on your base environment or into an existing conda environment using

pip install -r requirements.txt

🧪 Quick Start

Notebooks for reproducible experiments and demo scripts (running_examples.ipynb) are available in the code/notebooks/ folder. Experimental results are available in code/data/results/.

📔 Available Notebooks

We provide various .ipynb notebooks not only for reproducing the experimental results of the paper but also for getting started with our codebase. Specifically:

  • exp_0_increasing_density.ipynb contains experiments on the impact of using the sparsity penalty in the simulation on synthetic data against the number of edges
  • ex_1_dense_output.ipynb contains an experiment on using a dense graph as input to the TCS algorithm from the 1st phase of TCS. It also contains our experimental results on using the ground truth graph (oracle graph) with the sparsity penalty (see Figures 3a and 3b of our paper)
  • exp_2_oracle_graph.ipynb illustrates the behavior of TCS given the oracle graph as the 1st phase's output
  • exp_3_vs_baselines.ipynb contains baseline comparisons between TCS, CausalTime and non-causal simulators (CPAR, TVAE) (Table 3 of our paper)
  • exp_4_cd_efficacy.ipynb corresponds to our CD Efficacy experiments (Table 2 of our paper)
  • exp_5_random_output.ipynb observes the behavior of TCS when choosing a random configuration from the TSCM space. This serves as a baseline method.
  • running_examples.ipynb represents two running examples of the TCS codebase: (i) one running a single TCS simulation with a configuration of PCMCI Causal Discovery algorithm, gradient boosting predictor and spline noise estimators and (ii) an optimized TCS simulation with our proposed Min-max selection scheme.

📁 Structure

├── code
│   ├── CausalTime
│   │   ├── dataloader.py
│   │   ├── demo.py
│   │   ├── generate.py
│   │   ├── __init__.py
│   │   ├── models.py
│   │   ├── test.py
│   │   ├── tools.py
│   │   ├── train.py
│   │   ├── utilities.py
│   │   └── visualization.py
│   ├── cd_methods
│   │   ├── CausalPretraining
│   │   │   ├── helpers
│   │   │   │   ├── __init__.py
│   │   │   │   └── tools.py
│   │   │   ├── __init__.py
│   │   │   └── model
│   │   │       ├── conv.py
│   │   │       ├── gru.py
│   │   │       ├── informer.py
│   │   │       ├── __init__.py
│   │   │       ├── mlp.py
│   │   │       └── model_wrapper.py
│   │   ├── DynoTears
│   │   │   ├── causalnex
│   │   │   │   ├── __init__.py
│   │   │   │   ├── README.md
│   │   │   │   └── structure
│   │   │   │       ├── categorical_variable_mapper.py
│   │   │   │       ├── dynotears.py
│   │   │   │       ├── __init__.py
│   │   │   │       ├── notears.py
│   │   │   │       ├── structure_model.py
│   │   │   │       └── transformers.py
│   │   │   ├── __init__.py
│   │   │   └── utils.py
│   │   └── __init__.py
│   ├── configs
│   │   ├── discrimination
│   │   │   ├── lstm_configs.json
│   │   │   ├── svc_configs.json
│   │   │   └── tempfile_max_len.json
│   │   └── simulation
│   │       ├── cd_configs.yaml
│   │       ├── fc_configs.yaml
│   │       └── nz_configs.yaml
│   ├── notebooks
│   │   ├── exp_0_increasing_density.ipynb
│   │   ├── exp_1_dense_output.ipynb
│   │   ├── exp_2_oracle_graph.ipynb
│   │   ├── exp_3_vs_baselines.ipynb
│   │   ├── exp_4_cd_efficacy.ipynb
│   │   ├── exp_5_random_output.ipynb
│   │   ├── exp_6_synthetic_scalable_data.ipynb
│   │   ├── exp_7_c2st_sanity_checks.ipynb
│   │   └── running_examples.ipynb
│   ├── PretrainedForecasters
│   │   ├── __init__.py
│   │   └── TimesFMForecaster.py
│   ├── RealNVP
│   │   ├── __init__.py
│   │   ├── RealNVP.py
│   │   └── RealNVP_pytorch.py
│   ├── simulation
│   │   ├── delong.py
│   │   ├── detection_lstm.py
│   │   ├── __init__.py
│   │   ├── simulation_configs.py
│   │   ├── simulation_metrics.py
│   │   ├── simulation_tools.py
│   │   └── simulation_utils.py
│   ├── TCDF
│   │   ├── depthwise.py
│   │   ├── forecaster.py
│   │   ├── __init__.py
│   │   ├── model.py
│   │   └── TCDF.py
│   ├── tempogen
│   │   ├── functional_utils.py
│   │   ├── __init__.py
│   │   ├── temporal_causal_structure.py
│   │   ├── temporal_node.py
│   │   ├── temporal_random_generation.py
│   │   └── temporal_scm.py
│   └── utils.py
├── data
│   ├── cp_style
│   │   ├── cp_0_L_1L
│   │   │   ├── data
│   │   │   │   ├── cp_collection_data_0.csv
│   │   │   │   ├── cp_collection_data_10.csv
│   │   │   │   ├── cp_collection_data_11.csv
│   │   │   │   ├── cp_collection_data_12.csv
│   │   │   │   ├── cp_collection_data_13.csv
│   │   │   │   ├── cp_collection_data_14.csv
│   │   │   │   ├── cp_collection_data_15.csv
│   │   │   │   ├── cp_collection_data_16.csv
│   │   │   │   ├── cp_collection_data_17.csv
│   │   │   │   ├── cp_collection_data_18.csv
│   │   │   │   ├── cp_collection_data_19.csv
│   │   │   │   ├── cp_collection_data_1.csv
│   │   │   │   ├── cp_collection_data_2.csv
│   │   │   │   ├── cp_collection_data_3.csv
│   │   │   │   ├── cp_collection_data_4.csv
│   │   │   │   ├── cp_collection_data_5.csv
│   │   │   │   ├── cp_collection_data_6.csv
│   │   │   │   ├── cp_collection_data_7.csv
│   │   │   │   ├── cp_collection_data_8.csv
│   │   │   │   └── cp_collection_data_9.csv
│   │   │   └── structure
│   │   │       ├── cp_collection_struct_0.pt
│   │   │       ├── cp_collection_struct_10.pt
│   │   │       ├── cp_collection_struct_11.pt
│   │   │       ├── cp_collection_struct_12.pt
│   │   │       ├── cp_collection_struct_13.pt
│   │   │       ├── cp_collection_struct_14.pt
│   │   │       ├── cp_collection_struct_15.pt
│   │   │       ├── cp_collection_struct_16.pt
│   │   │       ├── cp_collection_struct_17.pt
│   │   │       ├── cp_collection_struct_18.pt
│   │   │       ├── cp_collection_struct_19.pt
│   │   │       ├── cp_collection_struct_1.pt
│   │   │       ├── cp_collection_struct_2.pt
│   │   │       ├── cp_collection_struct_3.pt
│   │   │       ├── cp_collection_struct_4.pt
│   │   │       ├── cp_collection_struct_5.pt
│   │   │       ├── cp_collection_struct_6.pt
│   │   │       ├── cp_collection_struct_7.pt
│   │   │       ├── cp_collection_struct_8.pt
│   │   │       └── cp_collection_struct_9.pt
│   │   ├── cp_0_L_1L+
│   │   │   ├── data
│   │   │   │   ├── cp_collection_data_0.csv
│   │   │   │   ├── cp_collection_data_1.csv
│   │   │   │   ├── cp_collection_data_2.csv
│   │   │   │   ├── cp_collection_data_3.csv
│   │   │   │   ├── cp_collection_data_4.csv
│   │   │   │   ├── cp_collection_data_5.csv
│   │   │   │   ├── cp_collection_data_6.csv
│   │   │   │   ├── cp_collection_data_7.csv
│   │   │   │   ├── cp_collection_data_8.csv
│   │   │   │   └── cp_collection_data_9.csv
│   │   │   └── structure
│   │   │       ├── cp_collection_struct_0.pt
│   │   │       ├── cp_collection_struct_1.pt
│   │   │       ├── cp_collection_struct_2.pt
│   │   │       ├── cp_collection_struct_3.pt
│   │   │       ├── cp_collection_struct_4.pt
│   │   │       ├── cp_collection_struct_5.pt
│   │   │       ├── cp_collection_struct_6.pt
│   │   │       ├── cp_collection_struct_7.pt
│   │   │       ├── cp_collection_struct_8.pt
│   │   │       └── cp_collection_struct_9.pt
│   │   ├── cp_0_L_1L+-
│   │   │   ├── data
│   │   │   │   ├── cp_collection_data_0.csv
│   │   │   │   ├── cp_collection_data_1.csv
│   │   │   │   ├── cp_collection_data_2.csv
│   │   │   │   ├── cp_collection_data_3.csv
│   │   │   │   ├── cp_collection_data_4.csv
│   │   │   │   ├── cp_collection_data_5.csv
│   │   │   │   ├── cp_collection_data_6.csv
│   │   │   │   ├── cp_collection_data_7.csv
│   │   │   │   ├── cp_collection_data_8.csv
│   │   │   │   └── cp_collection_data_9.csv
│   │   │   └── structure
│   │   │       ├── cp_collection_struct_0.pt
│   │   │       ├── cp_collection_struct_1.pt
│   │   │       ├── cp_collection_struct_2.pt
│   │   │       ├── cp_collection_struct_3.pt
│   │   │       ├── cp_collection_struct_4.pt
│   │   │       ├── cp_collection_struct_5.pt
│   │   │       ├── cp_collection_struct_6.pt
│   │   │       ├── cp_collection_struct_7.pt
│   │   │       ├── cp_collection_struct_8.pt
│   │   │       └── cp_collection_struct_9.pt
│   │   ├── cp_0_NL_2L
│   │   │   ├── data
│   │   │   │   ├── cp_collection_data_0.csv
│   │   │   │   ├── cp_collection_data_10.csv
│   │   │   │   ├── cp_collection_data_11.csv
│   │   │   │   ├── cp_collection_data_12.csv
│   │   │   │   ├── cp_collection_data_13.csv
│   │   │   │   ├── cp_collection_data_14.csv
│   │   │   │   ├── cp_collection_data_15.csv
│   │   │   │   ├── cp_collection_data_16.csv
│   │   │   │   ├── cp_collection_data_17.csv
│   │   │   │   ├── cp_collection_data_18.csv
│   │   │   │   ├── cp_collection_data_19.csv
│   │   │   │   ├── cp_collection_data_1.csv
│   │   │   │   ├── cp_collection_data_2.csv
│   │   │   │   ├── cp_collection_data_3.csv
│   │   │   │   ├── cp_collection_data_4.csv
│   │   │   │   ├── cp_collection_data_5.csv
│   │   │   │   ├── cp_collection_data_6.csv
│   │   │   │   ├── cp_collection_data_7.csv
│   │   │   │   ├── cp_collection_data_8.csv
│   │   │   │   └── cp_collection_data_9.csv
│   │   │   └── structure
│   │   │       ├── cp_collection_struct_0.pt
│   │   │       ├── cp_collection_struct_10.pt
│   │   │       ├── cp_collection_struct_11.pt
│   │   │       ├── cp_collection_struct_12.pt
│   │   │       ├── cp_collection_struct_13.pt
│   │   │       ├── cp_collection_struct_14.pt
│   │   │       ├── cp_collection_struct_15.pt
│   │   │       ├── cp_collection_struct_16.pt
│   │   │       ├── cp_collection_struct_17.pt
│   │   │       ├── cp_collection_struct_18.pt
│   │   │       ├── cp_collection_struct_19.pt
│   │   │       ├── cp_collection_struct_1.pt
│   │   │       ├── cp_collection_struct_2.pt
│   │   │       ├── cp_collection_struct_3.pt
│   │   │       ├── cp_collection_struct_4.pt
│   │   │       ├── cp_collection_struct_5.pt
│   │   │       ├── cp_collection_struct_6.pt
│   │   │       ├── cp_collection_struct_7.pt
│   │   │       ├── cp_collection_struct_8.pt
│   │   │       └── cp_collection_struct_9.pt
│   │   ├── cp_0_NL_2L+
│   │   │   ├── data
│   │   │   │   ├── cp_collection_data_0.csv
│   │   │   │   ├── cp_collection_data_1.csv
│   │   │   │   ├── cp_collection_data_2.csv
│   │   │   │   ├── cp_collection_data_3.csv
│   │   │   │   ├── cp_collection_data_4.csv
│   │   │   │   ├── cp_collection_data_5.csv
│   │   │   │   ├── cp_collection_data_6.csv
│   │   │   │   ├── cp_collection_data_7.csv
│   │   │   │   ├── cp_collection_data_8.csv
│   │   │   │   └── cp_collection_data_9.csv
│   │   │   └── structure
│   │   │       ├── cp_collection_struct_0.pt
│   │   │       ├── cp_collection_struct_1.pt
│   │   │       ├── cp_collection_struct_2.pt
│   │   │       ├── cp_collection_struct_3.pt
│   │   │       ├── cp_collection_struct_4.pt
│   │   │       ├── cp_collection_struct_5.pt
│   │   │       ├── cp_collection_struct_6.pt
│   │   │       ├── cp_collection_struct_7.pt
│   │   │       ├── cp_collection_struct_8.pt
│   │   │       └── cp_collection_struct_9.pt
│   │   ├── cp_0_NL_3L
│   │   │   ├── data
│   │   │   │   ├── cp_collection_data_0.csv
│   │   │   │   ├── cp_collection_data_1.csv
│   │   │   │   ├── cp_collection_data_2.csv
│   │   │   │   ├── cp_collection_data_3.csv
│   │   │   │   ├── cp_collection_data_4.csv
│   │   │   │   ├── cp_collection_data_5.csv
│   │   │   │   ├── cp_collection_data_6.csv
│   │   │   │   ├── cp_collection_data_7.csv
│   │   │   │   ├── cp_collection_data_8.csv
│   │   │   │   └── cp_collection_data_9.csv
│   │   │   └── structure
│   │   │       ├── cp_collection_struct_0.pt
│   │   │       ├── cp_collection_struct_1.pt
│   │   │       ├── cp_collection_struct_2.pt
│   │   │       ├── cp_collection_struct_3.pt
│   │   │       ├── cp_collection_struct_4.pt
│   │   │       ├── cp_collection_struct_5.pt
│   │   │       ├── cp_collection_struct_6.pt
│   │   │       ├── cp_collection_struct_7.pt
│   │   │       ├── cp_collection_struct_8.pt
│   │   │       └── cp_collection_struct_9.pt
│   │   └── increasing_edges_cp_1
│   │       ├── data
│   │       │   ├── (000)_cp_v10_l1_p95_ts.csv
│   │       │   ├── (001)_cp_v10_l1_p92_ts.csv
│   │       │   ├── (002)_cp_v10_l1_p89_ts.csv
│   │       │   ├── (003)_cp_v10_l1_p86_ts.csv
│   │       │   ├── (004)_cp_v10_l1_p83_ts.csv
│   │       │   ├── (005)_cp_v10_l1_p80_ts.csv
│   │       │   ├── (006)_cp_v10_l1_p77_ts.csv
│   │       │   ├── (007)_cp_v10_l1_p74_ts.csv
│   │       │   ├── (008)_cp_v10_l1_p71_ts.csv
│   │       │   ├── (009)_cp_v10_l1_p68_ts.csv
│   │       │   ├── (010)_cp_v10_l1_p65_ts.csv
│   │       │   ├── (011)_cp_v10_l2_p98_ts.csv
│   │       │   ├── (012)_cp_v10_l2_p95_ts.csv
│   │       │   ├── (013)_cp_v10_l2_p92_ts.csv
│   │       │   ├── (014)_cp_v10_l2_p89_ts.csv
│   │       │   ├── (015)_cp_v10_l2_p86_ts.csv
│   │       │   ├── (016)_cp_v10_l2_p83_ts.csv
│   │       │   ├── (017)_cp_v10_l2_p80_ts.csv
│   │       │   └── (018)_cp_v10_l2_p77_ts.csv
│   │       └── structure
│   │           ├── (000)_cp_v10_l1_p95_struct.pt
│   │           ├── (001)_cp_v10_l1_p92_struct.pt
│   │           ├── (002)_cp_v10_l1_p89_struct.pt
│   │           ├── (003)_cp_v10_l1_p86_struct.pt
│   │           ├── (004)_cp_v10_l1_p83_struct.pt
│   │           ├── (005)_cp_v10_l1_p80_struct.pt
│   │           ├── (006)_cp_v10_l1_p77_struct.pt
│   │           ├── (007)_cp_v10_l1_p74_struct.pt
│   │           ├── (008)_cp_v10_l1_p71_struct.pt
│   │           ├── (009)_cp_v10_l1_p68_struct.pt
│   │           ├── (010)_cp_v10_l1_p65_struct.pt
│   │           ├── (011)_cp_v10_l2_p98_struct.pt
│   │           ├── (012)_cp_v10_l2_p95_struct.pt
│   │           ├── (013)_cp_v10_l2_p92_struct.pt
│   │           ├── (014)_cp_v10_l2_p89_struct.pt
│   │           ├── (015)_cp_v10_l2_p86_struct.pt
│   │           ├── (016)_cp_v10_l2_p83_struct.pt
│   │           ├── (017)_cp_v10_l2_p80_struct.pt
│   │           └── (018)_cp_v10_l2_p77_struct.pt
│   ├── finance
│   │   ├── random-rels_20_1_3_returns30007000_header.csv
│   │   ├── random-rels_20_1A_returns30007000_header.csv
│   │   ├── random-rels_20_1B_returns30007000_header.csv
│   │   ├── random-rels_20_1C_returns30007000_header.csv
│   │   ├── random-rels_20_1D_returns30007000_header.csv
│   │   └── random-rels_20_1E_returns30007000_header.csv
│   ├── fMRI
│   │   ├── graphs
│   │   │   ├── sim19_gt_processed.csv
│   │   │   ├── sim20_gt_processed.csv
│   │   │   ├── sim5_gt_processed.csv
│   │   │   ├── sim6_gt_processed.csv
│   │   │   ├── sim7_gt_processed.csv
│   │   │   └── sim9_gt_processed.csv
│   │   └── timeseries
│   │       ├── timeseries19.csv
│   │       ├── timeseries20.csv
│   │       ├── timeseries5.csv
│   │       ├── timeseries6.csv
│   │       ├── timeseries7.csv
│   │       └── timeseries9.csv
│   ├── MvTS
│   │   ├── air_quality_mini
│   │   │   ├── air_quality_mini_boot_0.csv
│   │   │   ├── air_quality_mini_boot_1.csv
│   │   │   ├── air_quality_mini_boot_2.csv
│   │   │   ├── air_quality_mini_boot_3.csv
│   │   │   └── air_quality_mini_boot_4.csv
│   │   ├── AirQualityUCI
│   │   │   ├── AirQualityUCI_boot_0.csv
│   │   │   ├── AirQualityUCI_boot_1.csv
│   │   │   ├── AirQualityUCI_boot_2.csv
│   │   │   ├── AirQualityUCI_boot_3.csv
│   │   │   └── AirQualityUCI_boot_4.csv
│   │   ├── bike-usage
│   │   │   ├── bike-usage_boot_0.csv
│   │   │   ├── bike-usage_boot_1.csv
│   │   │   ├── bike-usage_boot_2.csv
│   │   │   ├── bike-usage_boot_3.csv
│   │   │   └── bike-usage_boot_5.csv
│   │   ├── ETTh1
│   │   │   ├── ETTh1_boot_0.csv
│   │   │   ├── ETTh1_boot_1.csv
│   │   │   ├── ETTh1_boot_2.csv
│   │   │   ├── ETTh1_boot_3.csv
│   │   │   └── ETTh1_boot_4.csv
│   │   ├── ETTm1
│   │   │   ├── ETTm1_boot_0.csv
│   │   │   ├── ETTm1_boot_1.csv
│   │   │   ├── ETTm1_boot_2.csv
│   │   │   ├── ETTm1_boot_3.csv
│   │   │   └── ETTm1_boot_4.csv
│   │   ├── outdoor
│   │   │   └── outdoor_original.csv
│   │   └── WTH
│   │       ├── WTH_boot_0.csv
│   │       ├── WTH_boot_1.csv
│   │       ├── WTH_boot_2.csv
│   │       ├── WTH_boot_3.csv
│   │       └── WTH_boot_4.csv
│   └── results
│       ├── cd_efficacy
│       │   ├── simulated_ct
│       │   │   ├── air_quality_mini
│       │   │   │   ├── air_quality_mini_boot_0.csv
│       │   │   │   ├── air_quality_mini_boot_1.csv
│       │   │   │   ├── air_quality_mini_boot_2.csv
│       │   │   │   ├── air_quality_mini_boot_3.csv
│       │   │   │   └── air_quality_mini_boot_4.csv
│       │   │   ├── AirQualityUCI
│       │   │   │   └── AirQualityUCI_boot_4.csv
│       │   │   ├── bike-usage
│       │   │   │   ├── bike-usage_boot_0.csv
│       │   │   │   ├── bike-usage_boot_1.csv
│       │   │   │   ├── bike-usage_boot_2.csv
│       │   │   │   └── bike-usage_boot_5.csv
│       │   │   ├── cp_style
│       │   │   │   ├── (000)_cp_v10_l1_p95_ts.csv
│       │   │   │   ├── (001)_cp_v10_l1_p92_ts.csv
│       │   │   │   ├── (002)_cp_v10_l1_p89_ts.csv
│       │   │   │   ├── (003)_cp_v10_l1_p86_ts.csv
│       │   │   │   ├── (004)_cp_v10_l1_p83_ts.csv
│       │   │   │   ├── (005)_cp_v10_l1_p80_ts.csv
│       │   │   │   ├── (006)_cp_v10_l1_p77_ts.csv
│       │   │   │   ├── (007)_cp_v10_l1_p74_ts.csv
│       │   │   │   ├── (008)_cp_v10_l1_p71_ts.csv
│       │   │   │   └── (009)_cp_v10_l1_p68_ts.csv
│       │   │   ├── ETTh1
│       │   │   │   ├── ETTh1_boot_0.csv
│       │   │   │   ├── ETTh1_boot_1.csv
│       │   │   │   ├── ETTh1_boot_2.csv
│       │   │   │   ├── ETTh1_boot_3.csv
│       │   │   │   └── ETTh1_boot_4.csv
│       │   │   ├── ETTm1
│       │   │   │   ├── ETTm1_boot_0.csv
│       │   │   │   ├── ETTm1_boot_1.csv
│       │   │   │   ├── ETTm1_boot_2.csv
│       │   │   │   ├── ETTm1_boot_3.csv
│       │   │   │   └── ETTm1_boot_4.csv
│       │   │   ├── finance
│       │   │   │   ├── random-rels_20_1_3_returns30007000_header.csv
│       │   │   │   ├── random-rels_20_1A_returns30007000_header.csv
│       │   │   │   ├── random-rels_20_1B_returns30007000_header.csv
│       │   │   │   ├── random-rels_20_1C_returns30007000_header.csv
│       │   │   │   ├── random-rels_20_1D_returns30007000_header.csv
│       │   │   │   └── random-rels_20_1E_returns30007000_header.csv
│       │   │   ├── fMRI
│       │   │   │   ├── timeseries19.csv
│       │   │   │   ├── timeseries5.csv
│       │   │   │   ├── timeseries6.csv
│       │   │   │   ├── timeseries7.csv
│       │   │   │   └── timeseries9.csv
│       │   │   ├── outdoor
│       │   │   │   └── outdoor_original.csv
│       │   │   └── WTH
│       │   │       ├── WTH_boot_0.csv
│       │   │       ├── WTH_boot_1.csv
│       │   │       ├── WTH_boot_2.csv
│       │   │       ├── WTH_boot_3.csv
│       │   │       └── WTH_boot_4.csv
│       │   └── simulated_tcs
│       │       ├── air_quality_mini
│       │       │   ├── air_quality_mini_boot_0.csv
│       │       │   ├── air_quality_mini_boot_1.csv
│       │       │   ├── air_quality_mini_boot_2.csv
│       │       │   ├── air_quality_mini_boot_3.csv
│       │       │   └── air_quality_mini_boot_4.csv
│       │       ├── AirQualityUCI
│       │       │   └── AirQualityUCI_boot_4.csv
│       │       ├── bike-usage
│       │       │   ├── bike-usage_boot_0.csv
│       │       │   ├── bike-usage_boot_1.csv
│       │       │   ├── bike-usage_boot_2.csv
│       │       │   └── bike-usage_boot_5.csv
│       │       ├── cp_style
│       │       │   ├── (000)_cp_v10_l1_p95_ts.csv
│       │       │   ├── (001)_cp_v10_l1_p92_ts.csv
│       │       │   ├── (002)_cp_v10_l1_p89_ts.csv
│       │       │   ├── (003)_cp_v10_l1_p86_ts.csv
│       │       │   ├── (004)_cp_v10_l1_p83_ts.csv
│       │       │   ├── (005)_cp_v10_l1_p80_ts.csv
│       │       │   ├── (006)_cp_v10_l1_p77_ts.csv
│       │       │   ├── (007)_cp_v10_l1_p74_ts.csv
│       │       │   ├── (008)_cp_v10_l1_p71_ts.csv
│       │       │   └── (009)_cp_v10_l1_p68_ts.csv
│       │       ├── ETTh1
│       │       │   ├── ETTh1_boot_0.csv
│       │       │   ├── ETTh1_boot_1.csv
│       │       │   ├── ETTh1_boot_2.csv
│       │       │   ├── ETTh1_boot_3.csv
│       │       │   └── ETTh1_boot_4.csv
│       │       ├── ETTm1
│       │       │   ├── ETTm1_boot_0.csv
│       │       │   ├── ETTm1_boot_1.csv
│       │       │   ├── ETTm1_boot_2.csv
│       │       │   ├── ETTm1_boot_3.csv
│       │       │   └── ETTm1_boot_4.csv
│       │       ├── finance
│       │       │   ├── random-rels_20_1_3_returns30007000_header.csv
│       │       │   ├── random-rels_20_1A_returns30007000_header.csv
│       │       │   ├── random-rels_20_1B_returns30007000_header.csv
│       │       │   ├── random-rels_20_1C_returns30007000_header.csv
│       │       │   ├── random-rels_20_1D_returns30007000_header.csv
│       │       │   └── random-rels_20_1E_returns30007000_header.csv
│       │       ├── fMRI
│       │       │   ├── timeseries19.csv
│       │       │   ├── timeseries5.csv
│       │       │   ├── timeseries6.csv
│       │       │   ├── timeseries7.csv
│       │       │   └── timeseries9.csv
│       │       ├── outdoor
│       │       │   └── outdoor_original.csv
│       │       └── WTH
│       │           ├── WTH_boot_0.csv
│       │           ├── WTH_boot_1.csv
│       │           ├── WTH_boot_2.csv
│       │           ├── WTH_boot_3.csv
│       │           └── WTH_boot_4.csv
│       ├── dense_graph
│       │   ├── res_cp_vs_1.p
│       │   ├── res_cp_vs_2n.p
│       │   ├── res_cp_vs_2.p
│       │   ├── res_cp_vs_3n.p
│       │   ├── res_cp_vs_4n.p
│       │   └── res_cp_vs_5n.p
│       ├── figures
│       │   ├── sparsity_penalty_cp1.png
│       │   └── sparsity_penalty_cp1_short.png
│       ├── oracle_graph
│       │   ├── res_cp_just_1.p
│       │   ├── res_cp_ora_1.p
│       │   ├── res_cp_ora_2n.p
│       │   ├── res_cp_ora_3n.p
│       │   ├── res_cp_ora_4n.p
│       │   ├── res_cp_ora_5n.p
│       │   └── res_cp_vs_1.p
│       ├── random_graph
│       │   ├── res_cp_vs_1.p
│       │   ├── res_cp_vs_2.p
│       │   └── res_cp_vs_3.p
│       ├── sparsity_penalty
│       │   └── res_cp_vs_2.p
│       └── vs
│           ├── air_quality_mini_auc.json
│           ├── air_quality_mini_mmd.json
│           ├── AirQualityUCI_auc.json
│           ├── AirQualityUCI_mmd.json
│           ├── bike-usage_auc.json
│           ├── bike-usage_mmd.json
│           ├── cp_0_L_1L+_auc.json
│           ├── cp_0_L_1L_auc.json
│           ├── cp_0_L_1L+_mmd.json
│           ├── cp_0_L_1L_mmd.json
│           ├── cp_0_L_1L+_shd.json
│           ├── cp_0_L_1L_shd.json
│           ├── cp_0_NL_2L+_auc.json
│           ├── cp_0_NL_2L_auc.json
│           ├── cp_0_NL_2L+_mmd.json
│           ├── cp_0_NL_2L_mmd.json
│           ├── cp_0_NL_2L+_shd.json
│           ├── cp_0_NL_2L_shd.json
│           ├── cp_0_NL_3L_auc.json
│           ├── cp_0_NL_3L_mmd.json
│           ├── cp_0_NL_3L_shd.json
│           ├── cp_1_auc.json
│           ├── cp_1_mmd.json
│           ├── finance_auc.json
│           ├── finance_mmd.json
│           ├── fmri_auc.json
│           ├── fmri_mmd.json
│           ├── outdoor_auc.json
│           ├── outdoor_mmd.json
│           ├── WTH_auc.json
│           └── WTH_mmd.json
├── environment.yaml
├── LICENSE
├── README.md
└── requirements.txt

✨ Pretrained Weights

CP Weights (to be optionally included in Phase 1 of TCS -see simulation_configs.py) are provided outside GitHub due to size constraints, in the following Google Drive links:

The first model corresponds to $16.1M$ parameters, while the other to $391M$.

📚 Citation

If the codebase has proven useful, please consider citing the following article:

@misc{gkorgkolis2025temporal,
      title={Temporal Causal-based Simulation for Realistic Time-series Generation}, 
      author={Nikolaos Gkorgkolis and Nikolaos Kougioulis and MingXue Wang and Bora Caglayan and Andrea Tonon and Dario Simionato and Ioannis Tsamardinos},
      year={2025},
      eprint={2506.02084},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2506.02084}, 
}

🥰 Contributing

Contributions are welcome! Feel free to:

  • Open issues for bugs, questions, or feature requests
  • Submit pull requests for improvements or new functionality

We follow standard GitHub practices for contributions, see our CONTRIBUTING file.

About

Code for the paper "Temporal Causal-based Simulation for Realistic Time-series Generation".

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 59.3%
  • Python 40.7%