{"id":31021472,"url":"https://github.com/sisl/variational_koopman","last_synced_at":"2025-09-13T11:22:03.706Z","repository":{"id":45696956,"uuid":"189092659","full_name":"sisl/variational_koopman","owner":"sisl","description":"Source code for \"Deep Variational Koopman Models: Inferring Koopman Observations for Uncertainty-Aware Dynamics Modeling and Control\" from IJCAI 2019. ","archived":false,"fork":false,"pushed_at":"2019-05-28T19:45:18.000Z","size":19,"stargazers_count":34,"open_issues_count":1,"forks_count":16,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-03-24T17:10:24.982Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sisl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-28T19:44:26.000Z","updated_at":"2024-03-21T09:13:42.000Z","dependencies_parsed_at":"2022-09-03T11:42:05.207Z","dependency_job_id":null,"html_url":"https://github.com/sisl/variational_koopman","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sisl/variational_koopman","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisl%2Fvariational_koopman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisl%2Fvariational_koopman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisl%2Fvariational_koopman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisl%2Fvariational_koopman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sisl","download_url":"https://codeload.github.com/sisl/variational_koopman/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisl%2Fvariational_koopman/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274955900,"owners_count":25380669,"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","status":"online","status_checked_at":"2025-09-13T02:00:10.085Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-09-13T11:21:59.194Z","updated_at":"2025-09-13T11:22:03.696Z","avatar_url":"https://github.com/sisl.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deep Variational Koopman Models\nSource code for \"Deep Variational Koopman Models: Inferring Koopman Observations for Uncertainty-Aware Dynamics Modeling and Control\" from IJCAI 2019. The paper can be found [here](https://arxiv.org/pdf/1902.09742.pdf).\n\n## Overview\nA description of the individual files is given below.\n* ```variational_koopman_model.py``` - script for defining architecture of and constructing Deep Variational Koopman models for training.\n* ```train_variational_koopman.py``` - training script for Deep Variational Koopman models.\n* ```replay_memory.py``` - script for loading and processing data prior to and during training.\n* ```utils.py``` - contains functions for visualizing performance of trained models and performing MPC rollouts.\n* ```controller.py``` - script for performing DDP (essentially iLQR) for optimizing action sequences.\n\n### Training and Evaluating a Model\nTo train a Deep Variational Koopman model on data from the inverted pendulum environment with the model architecture used in the experiments within the paper, run ```train_variational_koopman.py``` with the following arguments:\n\n```python3 train_variational_koopman.py --seq_length 16 --n_trials 20 --n_subseq 220 --kl_weight 0.1 --extractor_size 64 64 --inference_size 64 64 --prior_size 64 32```\n\nThis will extract data from 20 trials within the inverted pendulum environment, where each trial is 256 time steps in length and actions are selected randomly. \n\nTo train a model and subsequently incorporate it into MPC, run the above command and include the argument ```--ilqr True```. This will train a model, perform ```n_trials/10``` MPC rollouts using the trained model, then incorporate the data from the rollouts into the training/validation sets and train a new model on the full dataset. This process will terminate once a reward threshold is reached.\n\nTo train models on data from different environments, include the argument ```--domain_name (domain_name)```, where ```(domain_name)``` is the name of the associated environment, such as ```--domain_name CartPole-v1```. Currently it is not possible to perform MPC with any environment other than inverted pendulum.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsisl%2Fvariational_koopman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsisl%2Fvariational_koopman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsisl%2Fvariational_koopman/lists"}