{"id":19705956,"url":"https://github.com/llnl/deltauq","last_synced_at":"2025-04-29T16:32:16.029Z","repository":{"id":62856287,"uuid":"563126577","full_name":"LLNL/DeltaUQ","owner":"LLNL","description":null,"archived":false,"fork":false,"pushed_at":"2023-11-30T20:57:19.000Z","size":17569,"stargazers_count":12,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-05T18:05:45.070Z","etag":null,"topics":["deep-learning","machine-learning"],"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/LLNL.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":"2022-11-08T00:42:26.000Z","updated_at":"2024-08-19T04:01:33.000Z","dependencies_parsed_at":"2023-11-30T21:43:41.849Z","dependency_job_id":null,"html_url":"https://github.com/LLNL/DeltaUQ","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/LLNL%2FDeltaUQ","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LLNL%2FDeltaUQ/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LLNL%2FDeltaUQ/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LLNL%2FDeltaUQ/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LLNL","download_url":"https://codeload.github.com/LLNL/DeltaUQ/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251540324,"owners_count":21605884,"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":["deep-learning","machine-learning"],"created_at":"2024-11-11T21:32:24.325Z","updated_at":"2025-04-29T16:32:11.002Z","avatar_url":"https://github.com/LLNL.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# $\\Delta$-UQ\n\nScripts and demo for [`Single Model Uncertainty Estimation via Stochastic Data Centering`](https://arxiv.org/abs/2207.07235v1), NeurIPS 2022.\n\n**TLDR**: $\\Delta$-UQ is a simple strategy that can be used to train a _single_ DNN model to produce meaningful uncertainties.\n\n\u003cimg src=\"/demo/files/duq.png\" alt=\"delta-UQ\" title=\"delta-UQ\"\u003e\n\n## Train your own $\\Delta$-UQ model (CNNs or MLPs)\nWe provide a easy-to-use simple wrapper that can be used around most CNNs (and can be modified to work with any network) which works as follows:\n\nAnchoring requires double the input channels (in CNNs) or dimensions (in MLPs) -- so first modify your network accordingly:\n\n```\nbase_net = your_fav_CNN(in_channels=6) ## NOTE: 6 channels instead of 3\n```\n\nNext, use the provided utility to wrap your network to produce a $\\Delta$-UQ model -- thats it! \n\n```\nfrom lib.deltaUQ import deltaUQ_CNN as uq_wrapper\nnet_with_uq = uq_wrapper(base_net)\n```\n\nYou can treat this model as a drop-in replacement for your old model, same loss function and hparams, its that easy!\n\n```\ninputs = torch.randn(64,3,32,32)\n\npred = net_with_uq(inputs) ## Drop in replacement for training\n\nloss = criterion(targets,pred)\n...\n```\nDuring inference, you can simply pass an additional flag to produce uncertainties:\n\n```\n\ntest_inputs = torch.randn(64,3,32,32)\n## (IMPORTANT: *** num test samples \u003e n_anchors \u003e 1 ***)\npred,unc = net_with_uq(test_inputs,n_anchors=5,return_std=True) \n```\n\n\nWe provide wrappers for CNNs and MLPs that modify the base class provided in [`deltaUQ.py`](./lib/deltaUQ.py). \n\n## Dependencies\nThis codebase was developed and tested using\n+ botorch `0.6.0`\n+ gpytorch `1.6.0`\n+ matplotlib `3.4.3`\n+ numpy `1.20.3`\n+ scikit_learn `1.1.3`\n+ PyTorch `1.13.1`\n\n## Citation\n\nIf you find this repository useful, please consider citing our work as:\n\n```\n@inproceedings{thiagarajan2022single,\ntitle={Single Model Uncertainty Estimation via Stochastic Data Centering},\nauthor={Jayaraman J. Thiagarajan and Rushil Anirudh and Vivek Narayanaswamy and Peer-timo Bremer},\nbooktitle={Advances in Neural Information Processing Systems},\neditor={Alice H. Oh and Alekh Agarwal and Danielle Belgrave and Kyunghyun Cho},\nyear={2022},\nurl={https://openreview.net/forum?id=j0J9upqN5va}\n}\n```\n## Related Works\nFor other applications that use neural network anchoring:\n\n* _Out of Distribution Detection via Neural Network Anchoring_, ACML 2022. [`github`](https://github.com/LLNL/AMP), [`paper`](https://arxiv.org/abs/2207.04125)\n* _Predicting the Generalization Gap in Deep Models using Anchoring_, ICASSP 2022. [`github`](https://github.com/vivsivaraman/deltauq_pred_gen), [`paper`](https://ieeexplore.ieee.org/abstract/document/9747136/)\n\u003c!-- ## Robustness\n\n## Predicting Generalization Gap in Deep Models\nTo run our experiments on using DeltaUQ for predicting domain generalization, follow the instructions provided in `./predicting_gen/` --\u003e\n## License\nThis code is distributed under the terms of the MIT license. All new contributions must be made under this license. LLNL-CODE-844746 SPDX-License-Identifier: MIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllnl%2Fdeltauq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fllnl%2Fdeltauq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllnl%2Fdeltauq/lists"}