{"id":13444641,"url":"https://github.com/clear-nus/NCDSSM","last_synced_at":"2025-03-20T19:30:37.540Z","repository":{"id":167247739,"uuid":"642842066","full_name":"clear-nus/NCDSSM","owner":"clear-nus","description":"PyTorch implementation of the NCDSSM models presented in the ICML '23 paper \"Neural Continuous-Discrete State Space Models for Irregularly-Sampled Time Series\".","archived":false,"fork":false,"pushed_at":"2023-07-09T07:03:36.000Z","size":303,"stargazers_count":24,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-28T08:41:54.278Z","etag":null,"topics":["continuous-time","forecasting","icml-2023","imputation","kalman-filter","state-space-model","time-series"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clear-nus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.bib","codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-05-19T13:19:03.000Z","updated_at":"2024-08-20T04:21:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"bcf813d1-cff7-47e7-85ec-46968786c33b","html_url":"https://github.com/clear-nus/NCDSSM","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.125,"last_synced_commit":"7212bba9616d81c948f507eef9eb1f7d5cf1954e"},"previous_names":["clear-nus/ncdssm"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clear-nus%2FNCDSSM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clear-nus%2FNCDSSM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clear-nus%2FNCDSSM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clear-nus%2FNCDSSM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clear-nus","download_url":"https://codeload.github.com/clear-nus/NCDSSM/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244676454,"owners_count":20491828,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["continuous-time","forecasting","icml-2023","imputation","kalman-filter","state-space-model","time-series"],"created_at":"2024-07-31T04:00:32.754Z","updated_at":"2025-03-20T19:30:36.988Z","avatar_url":"https://github.com/clear-nus.png","language":"Python","funding_links":[],"categories":["ICML 2023"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Neural Continuous-Discrete State Space Models (NCDSSM) \n\n[![preprint](https://img.shields.io/static/v1?label=arXiv\u0026message=2301.11308\u0026color=B31B1B)](https://arxiv.org/abs/2301.11308)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Venue:ICML 2023](https://img.shields.io/badge/Venue-ICML%202023-007CFF)](https://icml.cc/)\n\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/ncdssm.webp\" width=\"30%\"\u003e\n  \u003cbr /\u003e\n  \u003cspan\u003eFig 1. (Top) Generative model of Neural Continuous-Discrete State Space Model. (Bottom) Amortized inference for auxiliary variables and continuous-discrete Bayesian inference for states.\u003c/span\u003e\n\u003c/p\u003e\n\n____\nThis repository contains code for reproducing the experiments presented in the ICML 2023 paper [*Neural Continuous-Discrete State Space Models for Irregularly-Sampled Time Series*](https://arxiv.org/abs/2301.11308).\n\n## Installation\n\nNCDSSM requires Python 3.8 or higher.\n\n* Create a conda environment (optional, but recommended).\n```sh\nconda create --name ncdssm python=3.9\nconda activate ncdssm\n```\n* Clone this repo and install the package.\n```sh\n# Install package with all optional dependencies for running experiments\npip install --editable \".[exp]\"\n```\n\n## Usage\n### Generate or download datasets\n\n* For bouncing ball, damped pendulum, climate and Pymunk datasets, generate/download them by running the scripts in `data/`. \n```sh\n# Bouncing Ball dataset\npython data/bouncing_ball.py\n\n# Damped Pendulum dataset\npython data/damped_pendulum.py\n\n# USHCN Climate dataset\npython data/climate.py\n\n# Pymunk datasets\npython data/box.py\npython data/pong.py\n```\n* For CMU MoCap dataset, download the preprocessed dataset (the file named `mocap35.mat`) available at [cagatayyildiz/ODE2VAE](https://github.com/cagatayyildiz/ODE2VAE) and place it in `data/mocap/mocap35.mat`.\n\n### Training\n\nTrain models using `train_pymunk.py --config /path/to/config` for the Pymunk datasets and `train_ts.py --config /path/to/config` for all other datasets. The yaml config files can be found in `configs/`. The keys in the config files can also be passed as command line options to the training script as `--key value`.\n```sh\n# Train NCDSSM-NL on Damped Pendulum with 30% missing\npython train_ts.py --config configs/pendulum_ncdssmnl.yaml --train_missing_p 0.3\n\n# Train NCDSSM-LL on Bouncing Ball with 80% missing\npython train_ts.py --config configs/ball_ncdssmll.yaml --train_missing_p 0.8\n\n# Train NCDSSM-NL on CMU MoCap (setup 1)\npython train_ts.py --config configs/mocap_ncdssmnl.yaml\n\n# Train NCDSSM-LL on CMU MoCap (setup 2)\npython train_ts.py --config configs/mocap2_ncdssmll.yaml\n\n# Train NCDSSM-NL on USHCN Climate (first fold)\n# --sporadic means that data is missing both in time and feature dimensions\npython train_ts.py --sporadic --config configs/climate_ncdssmnl.yaml --data_fold 0\n\n# Train NCDSSM-LL on Box\npython train_pymunk.py --config configs/box_ncdssmll.yaml\n```\n\n### Evaluation\n\nOnce trained, models can be evaluated on the test set using the `eval_pymunk.py` and `eval_ts.py`. Alternatively, you may download our pretrained checkpoints from this repository's Releases or from [:hugs: hugging face](https://huggingface.co/abdulfatir/NCDSSM) and place them in `./checkpoints/`.\n```sh\n# Download pretrained checkpoint from Releases\nwget https://github.com/clear-nus/NCDSSM/releases/download/v0.0.1/checkpoints.tar.gz \\\n  \u0026\u0026 tar -xzf checkpoints.tar.gz \\\n  \u0026\u0026 rm checkpoints.tar.gz\n```\n\n```sh\n# Evaluate NCDSSM-NL on Damped Pendulum with 30% missing\npython eval_ts.py --ckpt checkpoints/damped_pendulum_0.3_ncdssmnl.pt --smooth\n\n# Evaluate NCDSSM-LL on Bouncing Ball with 80% missing\npython eval_ts.py --ckpt checkpoints/bouncing_ball_0.8_ncdssmll.pt --smooth\n\n# Evaluate NCDSSM-NL on CMU MoCap (Setup 1)\npython eval_ts.py --ckpt checkpoints/mocap_ncdssmnl.pt  --no_state_sampling --seed 0\n\n# Evaluate NCDSSM-LL on CMU MoCap (Setup 2)\npython eval_ts.py --ckpt checkpoints/mocap2_ncdssmll.pt  --no_state_sampling --seed 0\n\n# Evaluate NCDSSM-NL on USHCN Climate (first fold)\npython eval_ts.py --sporadic --ckpt checkpoints/climate_ncdssmnl.pt\n\n# Evaluate NCDSSM-LL on Box\npython eval_pymunk.py --ckpt checkpoints/box_ncdssmll.pt --wass --smooth --no_state_sampling --seed 0\n```\n\n### Questions\n\nFor any questions regarding the code or the paper, please email [Fatir](mailto:abdulfatir@u.nus.edu).\n\n### BibTeX\n\nIf you find this repository or the ideas presented in our paper useful, please consider citing.\n```\n@inproceedings{\nansari2023neural,\n    title={Neural Continuous-Discrete State Space Models for Irregularly-Sampled Time Series},\n    author={Ansari, Abdul Fatir and Heng, Alvin and Lim, Andre and Soh, Harold},\n    booktitle={International Conference on Machine Learning},\n    year={2023}\n}\n```\n\n### Acknowledgement \n\nThis repo contains parts of code based on the following repos.\n\n| Repo  | Copyright (c) | License |\n| ------------- | ---------- | ------------- |\n| [edebrouwer/gru_ode_bayes](https://github.com/edebrouwer/gru_ode_bayes)  |  Edward De Brouwer   | [MIT License](https://github.com/edebrouwer/gru_ode_bayes/blob/master/License.md) |\n| [cagatayyildiz/ODE2VAE](https://github.com/cagatayyildiz/ODE2VAE)  | Çağatay Yıldız  | NA |\n| [mannyray/KalmanFilter](https://github.com/mannyray/KalmanFilter) | @mannyray  | [MIT License](https://github.com/mannyray/KalmanFilter/blob/master/LICENSE) |\n| [simonkamronn/kvae](https://github.com/simonkamronn/kvae) | Simon Kamronn | [MIT License](https://github.com/simonkamronn/kvae/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclear-nus%2FNCDSSM","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclear-nus%2FNCDSSM","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclear-nus%2FNCDSSM/lists"}