{"id":19071754,"url":"https://github.com/blackhc/batchbald_redux","last_synced_at":"2025-08-19T13:32:31.348Z","repository":{"id":40145317,"uuid":"257541175","full_name":"BlackHC/batchbald_redux","owner":"BlackHC","description":"Reusable BatchBALD implementation","archived":false,"fork":false,"pushed_at":"2024-02-28T23:12:02.000Z","size":1356,"stargazers_count":71,"open_issues_count":5,"forks_count":14,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-28T05:50:52.490Z","etag":null,"topics":["active-learning","batchbald","machine-learning","nbdev","neurips-2019","pytorch"],"latest_commit_sha":null,"homepage":"https://blackhc.github.io/batchbald_redux/","language":"Jupyter Notebook","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/BlackHC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2020-04-21T09:12:36.000Z","updated_at":"2024-05-14T05:43:21.221Z","dependencies_parsed_at":"2024-05-14T05:43:15.406Z","dependency_job_id":"ce86ca9b-e143-4628-b9c4-86115d6a8354","html_url":"https://github.com/BlackHC/batchbald_redux","commit_stats":{"total_commits":52,"total_committers":4,"mean_commits":13.0,"dds":0.07692307692307687,"last_synced_commit":"ab06af0a7c67d6895a83632d0d977aa3475ea65f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":"fastai/nbdev_template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackHC%2Fbatchbald_redux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackHC%2Fbatchbald_redux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackHC%2Fbatchbald_redux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackHC%2Fbatchbald_redux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlackHC","download_url":"https://codeload.github.com/BlackHC/batchbald_redux/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230355828,"owners_count":18213535,"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":["active-learning","batchbald","machine-learning","nbdev","neurips-2019","pytorch"],"created_at":"2024-11-09T01:30:37.946Z","updated_at":"2024-12-19T00:09:36.488Z","avatar_url":"https://github.com/BlackHC.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BatchBALD Redux\n\u003e Clean reimplementation of \\\"BatchBALD: Efficient and Diverse Batch Acquisition for Deep Bayesian Active Learning\\\"\n\n\nFor an introduction \u0026 more information, see [https://blackhc.github.io/BatchBALD/](https://blackhc.github.io/BatchBALD/). The paper can be found at [http://arxiv.org/abs/1906.08158](http://arxiv.org/abs/1906.08158). The documentation for this version can be found under [https://github.com/BlackHC/batchbald_redux/](https://github.com/BlackHC/batchbald_redux/).\n\nThe original implementation used in the paper is available at [https://github.com/BlackHC/BatchBALD](https://github.com/BlackHC/BatchBALD).\n\nWe are grateful for fastai's [nbdev](https://nbdev.fast.ai/) which is powering this package.\n\nFor more information, explore the sections and notebooks in the left-hand menu.\nThe code is available on [https://github.com/BlackHC/batchbald_redux](https://github.com/BlackHC/batchbald_redux),\nand the website on [https://blackhc.github.io/batchbald_redux](https://blackhc.github.io/batchbald_redux).\n\n## Install\n\n`pip install batchbald_redux`\n\n## Motivation\n\nBatchBALD is an algorithm and acquisition function for Active Learning in a Bayesian setting using BNNs and MC dropout.\n\nThe aquisition function is the mutual information between the joint of a candidate batch and the model parameters $\\omega$:\n\n{% raw %}\n$$a_{\\text{BatchBALD}}((y_b)_B) = I[(y_b)_B;\\omega]$$\n{% endraw %}\n\nThe best candidate batch is one that maximizes this acquisition function.\n\nIn the paper, we show that this function satisfies sub-modularity, which provides us an optimality guarantee for a greedy algorithm. The candidate batch is selected using greedy expansion.\n\nJoint entropies are hard to estimate and, for everything to work, one also has to use consistent MC dropout, which keeps a set of dropout masks fixed while scoring the pool set.\n\nTo aid reproducibility and baseline reproduction, we provide this simpler and clearer reimplementation.\n\n## Please cite us\n\n```\n@misc{kirsch2019batchbald,\n    title={BatchBALD: Efficient and Diverse Batch Acquisition for Deep Bayesian Active Learning},\n    author={Andreas Kirsch and Joost van Amersfoort and Yarin Gal},\n    year={2019},\n    eprint={1906.08158},\n    archivePrefix={arXiv},\n    primaryClass={cs.LG}\n}\n```\n\n## How to use\n\nWe provide a simple example experiment that uses this package [here](docs/example_experiment.html).\n\nTo get a candidate batch using BatchBALD, we provide a simple API in [`batchbald_redux.batchbald.py`](batchbald_redux/batchbald.py):\n\n\n\u003ch4 id=\"get_batchbald_batch\" class=\"doc_header\"\u003e\u003ccode\u003eget_batchbald_batch\u003c/code\u003e\u003ca href=\"https://github.com/blackhc/batchbald_redux/tree/master/batchbald_redux/batchbald.py#L67\" class=\"source_link\" style=\"float:right\"\u003e[source]\u003c/a\u003e\u003c/h4\u003e\n\n\u003e \u003ccode\u003eget_batchbald_batch\u003c/code\u003e(**`log_probs_N_K_C`**:`Tensor`, **`batch_size`**:`int`, **`num_samples`**:`int`, **`dtype`**=*`None`*, **`device`**=*`None`*)\n\n\n\n\nWe also provide a simple implementation of consistent MC dropout in [`batchbald_redux.consistent_mc_dropout.py`](batchbald_redux/consistent_mc_dropout.py).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackhc%2Fbatchbald_redux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblackhc%2Fbatchbald_redux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackhc%2Fbatchbald_redux/lists"}