Package: libact
libact: Pool-based Active Learning in Pythonauthors: Yao-Yuan Yang, Shao-Chuan Lee, Yu-An Chung, Tung-En Wu, Si-An Chen,Hsuan-Tien LinIntroductionlibactis 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 theactive-learning-by-learningmeta-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.DocumentationThe technical report associated with the package is onarXiv, and the documentation for the latest release is available onreadthedocs.
Comments and questions on the package is welcomed atlibact-users@googlegroups.com. All contributions to the documentation are greatly appreciated!Basic DependenciesPython 2.7, 3.3, 3.4, 3.5, 3.6Python dependenciespip install -r requirements.txtDebian (>= 7) / Ubuntu (>= 14.04)sudo apt-get install build-essential gfortran libatlas-base-dev liblapacke-dev python3-devArchsudo pacman -S lapackemacOSbrew install openblasInstallationAfter resolving the dependencies, you may install the package via pip (for all users):sudo pip install libactor pip install in home directory:pip install --user libactor pip install from github repository for latest source:pip install git+https://github.com/ntucllab/libact.gitTo build and install from souce in your home directory:python setup.py install --userTo build and install from souce for all users on Unix/Linux:python setup.py build
sudo python setup.py installInstallation OptionsLIBACT_BUILD_HINTSVM: set this variable to 1 if you would like to build
hintsvm c-extension. If set to 0, you will not be able to use the HintSVM
query strategy. Default=1.LIBACT_BUILD_VARIANCE_REDUCTION: set this variable to 1 if you would like to
build variance reduction c-extension. If set to 0, you will not be able to use
the VarianceReduction query strategy. Default=1.Example:LIBACT_BUILD_HINTSVM=1 pip install git+https://github.com/ntucllab/libact.gitUsageThe main usage oflibactis as follows:qs=UncertaintySampling(trn_ds,method='lc')# query strategy instanceask_id=qs.make_query()# let the specified query strategy suggest a data to queryX,y=zip(*trn_ds.data)lb=lbr.label(X[ask_id])# query the label of unlabeled data from labeler instancetrn_ds.update(ask_id,lb)# update the dataset with newly queried dataSome examples are available under theexamplesdirectory. Before running, useexamples/get_dataset.pyto retrieve the dataset used by the examples.Available examples:plot: This example performs basic usage of libact. It splits
a fully-labeled dataset and remove some label from dataset to simulate
the pool-based active learning scenario. Each query of an unlabeled dataset is then equivalent to revealing one labeled example in the original data set.label_digits: This example shows how to use libact in the case
that you want a human to label the selected sample for your algorithm.albl_plot: This example compares the performance of ALBL
with other active learning algorithms.multilabel_plot: This example compares the performance of
algorithms under multilabel setting.alce_plot: This example compares the performance of
algorithms under cost-sensitive multi-class setting.Running testsTo run the test suite:python setup.py testTo run pylint, install pylint throughpip install pylintand run the following command in root directory:pylint libactTo measure the test code coverage, install coverage throughpip install coverageand run the following commands in root directory:coverage run --source libact --omit */tests/* setup.py test
coverage reportCitingIf you find this package useful, please cite the original works (see Reference of each strategy) as well as the following@techreport{YY2017,
  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 = {https://github.com/ntucllab/libact},
  note = {available as arXiv preprint \url{https://arxiv.org/abs/1710.00379}},
  month = oct,
  year = 2017
}AcknowledgmentsThe authors thank Chih-Wei Chang and other members of theComputational Learning Labat National Taiwan University for valuable discussions and various contributions to making this package better.