Skip to main content

An implementation of the BatchBALD algorithm

Project description

BatchBALD Redux

Clean reimplementation of "BatchBALD: Efficient and Diverse Batch Acquisition for Deep Bayesian Active Learning"

For an introduction & more information, see The paper can be found at

The original implementation used in the paper is available at

We are grateful for fastai's nbdev which is powering this package.

For more information, explore the sections and notebooks in the left-hand menu. The code is available on, and the website on


pip install batchbald_redux


BatchBALD is an algorithm and acquisition function for Active Learning in a Bayesian setting using BNNs and MC dropout.

The aquisition function is the mutual information between the joint of a candidate batch and the model parameters $\omega$:

{% raw %} $$a_{\text{BatchBALD}}((y_b)_B) = I[(y_b)_B;\omega]$$ {% endraw %}

The best candidate batch is one that maximizes this acquisition function.

In 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.

Joint 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.

To aid reproducibility and baseline reproduction, we provide this simpler and clearer reimplementation.

Please cite us

    title={BatchBALD: Efficient and Diverse Batch Acquisition for Deep Bayesian Active Learning},
    author={Andreas Kirsch and Joost van Amersfoort and Yarin Gal},

How to use

We provide a simple example experiment that uses this package here.

To get a candidate batch using BatchBALD, we provide a simple API in batchbald_redux.batchbald:


get_batchbald_batch(log_probs_N_K_C:Tensor, batch_size:int, num_samples:int, dtype=None, device=None)

We also provide a simple implementation of consistent MC dropout in batchbald_redux.consistent_mc_dropout.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

batchbald_redux-2.0.5.tar.gz (17.7 kB view hashes)

Uploaded source

Built Distribution

batchbald_redux-2.0.5-py3-none-any.whl (16.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page