All Projects → ElementAI → Baal

ElementAI / Baal

Licence: apache-2.0
Using approximate bayesian posteriors in deep nets for active learning

Projects that are alternatives of or similar to Baal

Youtube Code Repository
Repository for most of the code from my YouTube channel
Stars: ✭ 317 (-3.35%)
Mutual labels:  jupyter-notebook
Cc150
《程序员面试金典》(cc150)
Stars: ✭ 326 (-0.61%)
Mutual labels:  jupyter-notebook
Whylogs
Profile and monitor your ML data pipeline end-to-end
Stars: ✭ 328 (+0%)
Mutual labels:  jupyter-notebook
Jupyter Edu Book
Teaching and Learning with Jupyter
Stars: ✭ 325 (-0.91%)
Mutual labels:  jupyter-notebook
Dota Doai
This repo is the codebase for our team to participate in DOTA related competitions, including rotation and horizontal detection.
Stars: ✭ 326 (-0.61%)
Mutual labels:  jupyter-notebook
Pylightgbm
Python binding for Microsoft LightGBM
Stars: ✭ 328 (+0%)
Mutual labels:  jupyter-notebook
Node
Neural Oblivious Decision Ensembles for Deep Learning on Tabular Data
Stars: ✭ 323 (-1.52%)
Mutual labels:  jupyter-notebook
Medium
Code related to blog posts on my Medium page
Stars: ✭ 329 (+0.3%)
Mutual labels:  jupyter-notebook
Python Data Analysis And Image Processing Tutorial
파이썬을 활용한 데이터 분석과 이미지 처리 - 강의 자료 및 소스코드 Repository입니다.
Stars: ✭ 325 (-0.91%)
Mutual labels:  jupyter-notebook
Mth594 machinelearning
The materials for the course MTH 594 Advanced data mining: theory and applications (Dmitry Efimov, American University of Sharjah)
Stars: ✭ 327 (-0.3%)
Mutual labels:  jupyter-notebook
Scipy Cookbook
Scipy Cookbook
Stars: ✭ 326 (-0.61%)
Mutual labels:  jupyter-notebook
Nlp fundamentals
📘 Contains a series of hands-on notebooks for learning the fundamentals of NLP
Stars: ✭ 328 (+0%)
Mutual labels:  jupyter-notebook
Models
A collection of pre-trained, state-of-the-art models in the ONNX format
Stars: ✭ 4,226 (+1188.41%)
Mutual labels:  jupyter-notebook
Pytorchneuralstyletransfer
Implementation of Neural Style Transfer in Pytorch
Stars: ✭ 327 (-0.3%)
Mutual labels:  jupyter-notebook
Machine Learning In 90 Days
Stars: ✭ 321 (-2.13%)
Mutual labels:  jupyter-notebook
Ml Art Colabs
A list of Machine Learning Art Colabs
Stars: ✭ 308 (-6.1%)
Mutual labels:  jupyter-notebook
Tutorials
Jupyter notebook tutorials from QuantConnect website for Python, Finance and LEAN.
Stars: ✭ 323 (-1.52%)
Mutual labels:  jupyter-notebook
Notebooks
Google Cloud Datalab samples and documentation
Stars: ✭ 328 (+0%)
Mutual labels:  jupyter-notebook
Azurepublicdataset
Microsoft Azure Traces
Stars: ✭ 327 (-0.3%)
Mutual labels:  jupyter-notebook
Homemade Machine Learning
🤖 Python examples of popular machine learning algorithms with interactive Jupyter demos and math being explained
Stars: ✭ 18,594 (+5568.9%)
Mutual labels:  jupyter-notebook

Bayesian Active Learning (Baal)

CircleCI Documentation Status Gitter

BaaL is an active learning library developed at ElementAI. This repository contains techniques and reusable components to make active learning accessible for all.

Read the documentation at https://baal.readthedocs.io.

Our paper can be read on arXiv. It includes tips and tricks to make active learning usable in production.

In this blog post, we present our library.

For a quick introduction to BaaL and Bayesian active learning, please see this presentation.

Installation and requirements

BaaL requires Python>=3.6.

To install baal using pip: pip install baal

To install baal from source: pip install -e .

For requirements please see: requirements.txt.

What is Active Learning?

Active learning is a special case of machine learning in which a learning algorithm is able to interactively query the user (or some other information source) to obtain the desired outputs at new data points (to understand the concept in more depth, refer to our tutorial).

BaaL Framework

At the moment BaaL supports the following methods to perform active learning.

  • Monte-Carlo Dropout (Gal et al. 2015)
  • MCDropConnect (Mobiny et al. 2019)
  • Deep ensembles
  • Semi-supervised learning

If you want to propose new methods, please submit an issue.

The Monte-Carlo Dropout method is a known approximation for Bayesian neural networks. In this method, the dropout layer is used both in training and test time. By running the model multiple times whilst randomly dropping weights, we calculate the uncertainty of the prediction using one of the uncertainty measurements in heuristics.py.

The framework consists of four main parts, as demonstrated in the flowchart below:

  • ActiveLearningDataset
  • Heuristics
  • ModelWrapper
  • ActiveLearningLoop

To get started, wrap your dataset in our ActiveLearningDataset class. This will ensure that the dataset is split into training and pool sets. The pool set represents the portion of the training set which is yet to be labelled.

We provide a lightweight object ModelWrapper similar to keras.Model to make it easier to train and test the model. If your model is not ready for active learning, we provide Modules to prepare them.

For example, the MCDropoutModule wrapper changes the existing dropout layer to be used in both training and inference time and the ModelWrapper makes the specifies the number of iterations to run at training and inference.

In conclusion, your script should be similar to this:

dataset = ActiveLearningDataset(your_dataset)
dataset.label_randomly(INITIAL_POOL)  # label some data
model = MCDropoutModule(your_model)
model = ModelWrapper(model, your_criterion)
active_loop = ActiveLearningLoop(dataset,
                                 get_probabilities=model.predict_on_dataset,
                                 heuristic=heuristics.BALD(shuffle_prop=0.1),
                                 ndata_to_label=NDATA_TO_LABEL)
for al_step in range(N_ALSTEP):
    model.train_on_dataset(dataset, optimizer, BATCH_SIZE, use_cuda=use_cuda)
    if not active_loop.step():
        # We're done!
        break

For a complete experiment, we provide experiments/ to understand how to write an active training process. Generally, we use the ActiveLearningLoop provided at src/baal/active/active_loop.py. This class provides functionality to get the predictions on the unlabeled pool after each (few) epoch(s) and sort the next set of data items to be labeled based on the calculated uncertainty of the pool.

Re-run our Experiments

nvidia-docker build [--target base_baal] -t baal .
nvidia-docker run --rm baal python3 experiments/vgg_mcdropout_cifar10.py 

Use BaaL for YOUR Experiments

Simply clone the repo, and create your own experiment script similar to the example at experiments/vgg_experiment.py. Make sure to use the four main parts of BaaL framework. Happy running experiments

Dev install

Simply build the Dockerfile as below:

git clone [email protected]:ElementAI/baal.git
nvidia-docker build [--target base_baal] -t baal-dev .

Now you have all the requirements to start contributing to BaaL. YEAH!

Contributing!

To contribute, see CONTRIBUTING.md.

Who We Are!

"There is passion, yet peace; serenity, yet emotion; chaos, yet order."

At ElementAI, the BaaL team tests and implements the most recent papers on uncertainty estimation and active learning. The BaaL team is here to serve you!

How to cite

If you used BaaL in one of your project, we would greatly appreciate if you cite this library using this Bibtex:

@misc{atighehchian2019baal,
  title={BaaL, a bayesian active learning library},
  author={Atighehchian, Parmida and Branchaud-Charron, Frederic and Freyberg, Jan and Pardinas, Rafael and Schell, Lorne},
  year={2019},
  howpublished={\url{https://github.com/ElementAI/baal/}},
}

Licence

To get information on licence of this API please read LICENCE

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].