libact: Pool-based Active Learning in Python

Yao-Yuan Yang, Shao-Chuan Lee, Yu-An Chung, Tung-En Wu, Si-An Chen, Hsuan-Tien LinarXiv 2017

Abstract

libact is a Python package designed to make active learning easier for general users. The package not only implements several popular active learning strategies, but also features the active-learning-by-learning meta-algorithm that assists the users to automatically select the best strategy on the fly. Furthermore, the package provides a unified interface for implementing more strategies, models and application-specific labelers. The package is open-source on Github, and can be easily installed from Python Package Index repository.

Introduction

In traditional supervised learning, large labeled datasets are a prerequisite for model training. However, in many real-world scenarios, obtaining labels is the most resource-intensive phase of the pipeline, often requiring expensive expert intervention. Active Learning (AL) addresses this by iteratively querying the most informative unlabeled examples for labeling, aiming to achieve high predictive performance with minimal data.

Despite its theoretical advantages, AL implementation is often hindered by significant engineering overhead and the difficulty of selecting the optimal query strategy for a given task. libact is designed to bridge this gap, providing a unified, scikit-learn-style interface for pool-based active learning in Python.

Methods and Architecture

The libact library is built around four modular components that encapsulate the active learning workflow:

  1. Dataset: Manages the pool of labeled and unlabeled data, utilizing a callback mechanism to synchronize state across the system.
  2. QueryStrategy: Implements the logic for selecting the next instance to query. The library includes a comprehensive suite of strategies for binary, multi-class, and multi-label classification.
  3. Model: Provides wrappers for supervised learning models, including seamless integration with scikit-learn estimators.
  4. Labeler: Abstracts the oracle, supporting both automated simulations (via IdealLabeler) and human-in-the-loop interaction (via InteractiveLabeler).

The ALBL Meta-Algorithm

A standout feature of libact is the Active-Learning-By-Learning (ALBL) meta-algorithm. Choosing the "right" strategy (e.g., Uncertainty Sampling vs. QUIRE) is often a matter of trial and error. ALBL reformulates this selection as a multi-armed bandit problem, dynamically weighting and selecting the most effective strategy as the learning process progresses. This removes the need for manual algorithm tuning and provides a robust "safety net" for users.

Experimental Evaluation

The authors evaluated libact and the ALBL algorithm using three standard benchmark datasets from the LIBSVM repository: heart, australian, and diabetes.

Performance comparison of various active learning strategies and the ALBL meta-algorithm across the heart, australian, and diabetes datasets.

As shown in the figures above, the error rates for all strategies generally decrease as the number of queries increases. Notably, the ALBL meta-algorithm consistently tracks the performance of the best-performing individual strategy for each dataset. This demonstrates that ALBL can effectively automate strategy selection without sacrificing performance, providing near-optimal results without exhaustive pre-testing.

Conclusion

libact provides a standardized framework for active learning in the Python ecosystem. By prioritizing API consistency and introducing automated meta-algorithms like ALBL, it significantly lowers the barrier to entry for practitioners. While currently focused on pool-based learning, future iterations may expand to include stream-based scenarios and further optimize integration with the broader data science stack.

Summary updated

BibTeX
@misc{yang2017libact,
  author = {Yao-Yuan Yang and Shao-Chuan Lee and Yu-An Chung and Tung-En Wu and Si-An Chen and Hsuan-Tien Lin},
  title = {{libact: Pool-based Active Learning in Python}},
  year = {2017},
  eprint = {1710.00379},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1710.00379},
}
Figure