libact: Pool-based Active Learning in Python

authors: Yao-Yuan Yang, Shao-Chuan Lee, Yu-An Chung, Tung-En Wu, Si-An Chen, Hsuan-Tien Lin

Build Status Documentation Status PyPI version


libact is a Python package designed to make active learning easier for real-world 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 along with issue trackers on github, and can be easily installed from Python Package Index repository.


The technical report associated with the package is on arXiv, and the documentation for the latest release is available on readthedocs. Comments and questions on the package is welcomed at All contributions to the documentation are greatly appreciated!

Basic Dependencies


After resolving the dependencies, you may install the package via pip (for all users):

sudo pip install libact

or pip install in home directory:

pip install --user libact

or pip install from github repository for latest source:

pip install git+

To build and install from souce in your home directory:

python install --user

To build and install from souce for all users on Unix/Linux:

python build
sudo python install

Installation Options


LIBACT_BUILD_HINTSVM=1 pip install git+


The main usage of libact is as follows:

qs = UncertaintySampling(trn_ds, method='lc') # query strategy instance

ask_id = qs.make_query() # let the specified query strategy suggest a data to query
X, y = zip(*
lb = lbr.label(X[ask_id]) # query the label of unlabeled data from labeler instance
trn_ds.update(ask_id, lb) # update the dataset with newly queried data

Some examples are available under the examples directory. Before running, use examples/ to retrieve the dataset used by the examples.

Available examples:

Running tests

To run the test suite:

python test

To run pylint, install pylint through pip install pylint and run the following command in root directory:

pylint libact

To measure the test code coverage, install coverage through pip install coverage and run the following commands in root directory:

coverage run --source libact --omit */tests/* test
coverage report


If you find this package useful, please cite the original works (see Reference of each strategy) as well as the following

  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},
  institution = {National Taiwan University},
  url = {},
  note = {available as arXiv preprint \url{}},
  month = oct,
  year = 2017


The authors thank Chih-Wei Chang and other members of the Computational Learning Lab at National Taiwan University for valuable discussions and various contributions to making this package better.