{"id":15942375,"url":"https://github.com/mlech26l/bayesian_nn_safety","last_synced_at":"2025-04-03T21:17:11.835Z","repository":{"id":132033547,"uuid":"414479268","full_name":"mlech26l/bayesian_nn_safety","owner":"mlech26l","description":"Code repository of the NeurIPS 2021 paper Infinite Time Horizon Safety of Bayesian Neural Networks","archived":false,"fork":false,"pushed_at":"2022-04-11T05:52:12.000Z","size":3997,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-09T09:14:04.237Z","etag":null,"topics":["bayesian-deep-learning","bayesian-neural-networks","neural-networks"],"latest_commit_sha":null,"homepage":"https://proceedings.neurips.cc/paper/2021/file/544defa9fddff50c53b71c43e0da72be-Paper.pdf","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mlech26l.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-07T06:00:27.000Z","updated_at":"2021-12-09T09:58:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"89ac8db0-44ec-4ec7-8ec3-c73f818558b1","html_url":"https://github.com/mlech26l/bayesian_nn_safety","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlech26l%2Fbayesian_nn_safety","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlech26l%2Fbayesian_nn_safety/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlech26l%2Fbayesian_nn_safety/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlech26l%2Fbayesian_nn_safety/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mlech26l","download_url":"https://codeload.github.com/mlech26l/bayesian_nn_safety/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247078866,"owners_count":20879953,"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":["bayesian-deep-learning","bayesian-neural-networks","neural-networks"],"created_at":"2024-10-07T07:41:12.926Z","updated_at":"2025-04-03T21:17:11.812Z","avatar_url":"https://github.com/mlech26l.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Infinite Time Horizon Safety of Bayesian Neural Networks\n\nCode repository of the paper *Infinite Time Horizon Safety of Bayesian Neural Networks*, by Lechner, Mathias, Đorđe Žikelić, Krishnendu Chatterjee, and Thomas Henzinger published at NeurIPS 2021 [PDF](https://proceedings.neurips.cc/paper/2021/file/544defa9fddff50c53b71c43e0da72be-Paper.pdf)\n\n![alt](banner.gif)\n\n## Requirements\n\n```bash\npip3 install -U pip # Upgrade pip\npip3 install -U gym tensorflow mip seaborn gym\n```\n\nTested on Ubuntu 16.04 and Ubuntu 20.04 and Python 3.8.\n\nRunning the experiments requires a valid Gurobi license (freely available MIP solvers scale only to the LDS example).\n\nMake sure Gurobi is installed and added to the ```PATH``` and ```LD_LIBRARY_PATH``` environment variables\n\n```bash\nexport GUROBI_HOME=\"/xxxxxx/gurobi/903/linux64/\"\nexport PATH=\"${PATH}:${GUROBI_HOME}/bin\"\nexport LD_LIBRARY_PATH=\"${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib\"\n\n```\n\n\n## Files\n\n- ```lds_env.py``` Implementation of the LDS environment\n- ```pend_env.py``` Implementation of the inverted pendulum environment\n- ```car_env.py``` Implementation of the collision avoidance environment\n- ```run_mip.py``` Implementation of the verification loop (algorithm 1 in the paper) for the LDS and the inv-pend environment\n- ```mixed_integer_encoding.py``` Mixed-integer encoding module for ReLU networks  according to Tjeng et al. (Evaluating Robustness of Neural Networks with Mixed Integer Programming)\n- ```run_car_mip.py``` Implementation of the verification loop (algorithm 1 in the paper) for the collision avoidance environment (mostly equivalent to the file ```run_mip.py```)\n- ```weights``` Folder containing the pre-trained weights of the policies\n\n## Example usage\n\n```bash\n# Runs the verification loop with the LDS environment\npython3 run_mip.py --env lds\n# Runs the verification loop with the LDS environment and bootstrapping the invariant candidate network\npython3 run_mip.py --env lds --bootstrap\n# Runs the verification loop with the inv-pend environment with Bayesian weights in all layers\npython3 run_mip.py --env pend --first_layer\n# Runs the verification loop with the collision avoidance environment\npython3 run_car_mip.py --bootstrap\n```\n\n## Additional information\n\nThe networks with Bayesian weights in the second hidden layer only have a Guassian distribution with a standard deviation of 0.1, while the networks with both layers Bayesian have a standard deviation of 0.05.\n\nHere is an example of how the positive invariant changes during the learner-verifier training procedure:\n\n![alt](learn.gif)\n\n## Citation\n\n```bib\n@inproceedings{lechner2021infinite,\n  author    = {Mathias Lechner and Dorde Zikelic and Krishnendu Chatterjee and Thomas A. Henzinger},\n  title     = {Infinite Time Horizon Safety of Bayesian Neural Networks},\n  booktitle = {In Conference on Neural Information Processing Systems (NeurIPS)},\n  year      = {2021}\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlech26l%2Fbayesian_nn_safety","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmlech26l%2Fbayesian_nn_safety","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlech26l%2Fbayesian_nn_safety/lists"}