kausable/CausalDynamics
CausalDynamics: A large-scale benchmark for structural discovery of dynamical causal models NeurIPS 2025 A comprehensive benchmark framework designed to rigorously evaluate state-of-the-art causal discovery algorithms for dynamical systems. Key Features 1️⃣ Large-Scale Benchmark. Systematically evaluate state-of-the-art causal discovery algorithms on thousands of graph challenges with increasing difficulty. 2️⃣ Customizable Data Generation.… See the full description on the dataset page: https://huggingface.co/datasets/kausable/CausalDynamics.
5196
1import os2import tarfile3import shutil4import requests5 6def download_file(url: str, dest: str):7 """Download a file from a URL to a destination path."""8 if os.path.exists(dest):9 print(f"File '{dest}' already exists. Skipping download.")10 return11 print(f"Downloading {url} → {dest}")12 response = requests.get(url, stream=True)13 response.raise_for_status()14 with open(dest, 'wb') as f:15 for chunk in response.iter_content(chunk_size=8192):16 f.write(chunk)17 print(f"Downloaded: {dest}")18 19def extract_tar_gz(filepath: str, target_dir: str):20 """Extract a .tar.gz archive to a target directory."""21 print(f"Extracting {filepath} → {target_dir}")22 with tarfile.open(filepath, "r:gz") as tar:23 tar.extractall(path=target_dir)24 print(f"Extracted: {filepath}")25 26def main():27 base_url = "https://huggingface.co/datasets/kausable/CausalDynamics/resolve/main"28 subsets = ["climate", "simple", "coupled"]29 stages = ["inputs", "outputs"]30 31 base_dir = os.getcwd()32 target_base = os.path.join(base_dir, "data")33 os.makedirs(target_base, exist_ok=True)34 35 for stage in stages:36 stage_dir = os.path.join(base_dir, stage)37 os.makedirs(stage_dir, exist_ok=True)38 39 for subset in subsets:40 filename = f"{subset}.tar.gz"41 url = f"{base_url}/{stage}/{filename}"42 dest_path = os.path.join(stage_dir, filename)43 44 download_file(url, dest_path)45 extract_tar_gz(dest_path, target_base)46 47 # Remove downloaded input/output directories48 for stage in stages:49 dir_to_remove = os.path.join(base_dir, stage)50 if os.path.isdir(dir_to_remove):51 shutil.rmtree(dir_to_remove)52 print(f"Removed: {dir_to_remove}")53 54if __name__ == "__main__":55 main()56 57 