Library / SDK
ntucllab/libact avatar
ntucllab/libact

libact: Pool-Based Active Learning With a Bandit That Picks the Strategy

Pool-based active learning in Python

791 stars172 forksPythonBSD-2-Clause

At a glance

What is it?
libact bundles thirteen query strategies behind one interface and adds ActiveLearningByLearning, a meta-algorithm that chooses among them while labeling runs. The catch is a C extension build and a release cadence that stopped in 2019.
Who is it for?
Adopt libact if you already have a pool of unlabeled data, a labeling loop you control, and you want to compare strategies such as CoreSet, BALD or QUIRE without writing each one yourself. Skip it if you need a maintained release line, Windows-native support, or deep-learning query strategies that the package does not list.
Can I use it commercially?
Yes. BSD-2-Clause is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 26 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

What libact Solves, and Who It Is Written For

Labeling is the expensive part of a supervised project. libact addresses the pool-based setting: you hold a set of unlabeled examples, a model, and a labeling budget, and you decide which example to send to an annotator next. The README frames the package as making active learning easier for real-world users, and the strategy table backs that up with thirteen named query strategies rather than a single sampling rule. The intended reader is someone who already has a working classifier and a pool of unlabeled rows, not someone starting from raw data. If your labels arrive as a stream, or if you cannot choose what gets labeled, the pool assumption does not hold and the package's abstractions will not match your problem.

The Strategy Table Is the Product

The README lists the strategies by type. UncertaintySampling and EpsilonUncertaintySampling cover exploitation and epsilon-greedy exploration. CoreSet is k-Center Greedy, selecting the point farthest from the labeled set, which is a diversity criterion rather than an uncertainty one. BALD measures epistemic uncertainty through ensemble disagreement, described as mutual information. InformationDensity and DWUS weight uncertainty by density so that outliers are not queried first. QueryByCommittee votes across a committee of models. QUIRE combines informativeness and representativeness. RandomSampling exists as a baseline, which matters because active learning results without a random baseline are hard to interpret. VarianceReduction and HintSVM are flagged in the README as requiring a C extension, so those two are the ones that can be absent from a working install.

ActiveLearningByLearning: A Bandit Over Strategies

The meta-algorithm is the part of libact that is not simply a reimplementation of published sampling rules. ActiveLearningByLearning is described as a multi-armed bandit that selects the best strategy on the fly, and the README links the AAAI 2015 paper behind it. The practical consequence is that you do not have to commit to one strategy before seeing how the labeling run behaves. The cost is that the bandit needs budget to explore. Early queries are partly spent on strategies that will later be abandoned, so on a small labeling budget the meta-algorithm can trail a well-chosen fixed strategy. That is a design trade-off, not a defect, but it is the reason a short pilot run with ALBL is not a fair test of it.

Installation, Build Flags and the C Extensions

The official release installs with pip install libact. The README recommends WSL for Windows users, which is a plain statement that native Windows is not the supported path. Two build options are exposed through meson config settings: variance_reduction and hintsvm, both defaulting to true. To drop them, the README gives pip install libact --config-settings=setup-args="-Dvariance_reduction=false" --config-settings=setup-args="-Dhintsvm=false". The blas and lapack options accept auto, openblas, Accelerate, mkl, lapack or blis. For development, the README recommends a conda environment created from the repository's environment.yml, followed by pip install --no-build-isolation -e . after installing meson-python, meson, ninja, cython and numpy. Editable installs without build isolation rebuild compiled components on import, which is why the build tools must stay in the environment. The README also notes that regular installs do not require build tools at runtime. Runtime dependencies are numpy >= 2, scipy >= 1.13, scikit-learn >= 1.6, matplotlib >= 3.8 and joblib, on Python 3.9 through 3.12.

What the Release History Tells You About Maintenance

The most recent tagged release is v0.1.5 from September 2019, described as supporting CSR sparse matrices. v0.1.4 landed in June 2019 and v0.1.3 in May 2017. The repository itself is not archived and the last push date is recent, so the codebase is not abandoned in the literal sense. The gap matters anyway: the dependency floors in the README (numpy 2, scikit-learn 1.6) are far newer than the last release tag, which suggests the documented environment tracks the current master branch rather than the PyPI artifact. If you pin libact from PyPI, check which numpy and scikit-learn versions that release was built against before assuming the README's floors apply. The BSD-2-Clause licence is permissive and imposes few conditions on redistribution; this is a description of the licence identifier, not legal advice, and you should read the LICENSE file and your own obligations before shipping it inside a product.

Where libact Is the Wrong Tool

The package targets pool-based selection with classical models. The model table in the README names LogisticRegression, SVM, Perceptron and a SklearnAdapter, so the path to a deep network runs through the adapter rather than through a native integration. If your active learning loop is built around a transformer fine-tuning pipeline, you will be writing the adapter glue yourself, and the ensemble-based strategies such as BALD will need an ensemble you construct. The second limitation is the C extension surface. VarianceReduction and HintSVM are the two strategies that can silently be missing from an install built with the flags disabled, so a strategy comparison that includes them is only reproducible if you record the build flags used. Third, the Windows recommendation of WSL means a native Windows CI job is outside the documented path. None of these is disqualifying, but each one changes what you must verify before trusting a result.

The Nearest Alternative and the Difference in Approach

modAL is the obvious comparison for a Python pool-based active learning library, and the difference is in the meta-layer rather than the sampling rules. modAL is built around a scikit-learn style estimator wrapper with a query strategy passed in, so the choice of strategy is yours and fixed for the run. libact ships the same kind of per-strategy interface plus ActiveLearningByLearning, which treats strategy selection as a multi-armed bandit problem solved during labeling. That extra layer is the reason to pick libact over a thinner library, and the reason to avoid it if you want a single, explainable sampling rule that you can defend to an annotator. A second difference sits in the build: libact compiles C extensions for VarianceReduction and HintSVM, which buys those two strategies at the cost of a meson and BLAS toolchain.

Adoption Checklist Before You Commit

Confirm three things in this order. First, that your labeling budget is large enough for ALBL's exploration phase; if it is not, pick a fixed strategy from the table and skip the meta-algorithm. Second, that the C extensions built: import VarianceReduction and HintSVM after pip install libact and record whether they are present, because the build flags decide this and the README documents both states. Third, that your dependency pins match the release you installed, given that the newest tag predates the numpy 2 and scikit-learn 1.6 floors in the README. The repository is unarchived and pushes continue, so tracking master is a viable option, but the PyPI artifact and the documented environment are not obviously the same thing. Test on your own pool before you trust a strategy ranking.

Editorial conclusion

Adopt libact if you already have a pool of unlabeled data, a labeling loop you control, and you want to compare strategies such as CoreSet, BALD or QUIRE without writing each one yourself. Skip it if you need a maintained release line, Windows-native support, or deep-learning query strategies that the package does not list. Before committing, verify that your environment builds the optional C extensions: run pip install libact and then check that VarianceReduction and HintSVM import, because those two are the modules the build flags control.

Official sources

  1. License: BSD-2-Clause
  2. ntucllab/libact on GitHub
  3. Project website
  4. README
  5. Releases
Community notes

Community notes