The package scikit-activeml is a library of that covers the most relevant query strategies in active learning and implements tools to work with partially labeled data.
Project description
scikit-activeml
scikit-activeml is a Python module for active learning on top of SciPy and scikit-learn. It is distributed under the 3-Clause BSD licence.
The project was initiated in 2020 by the Intelligent Embedded Systems Group at University Kassel.
Installation
The easiest way of installing scikit-activeml is using pip
pip install -U scikit-activeml
Example
The following code implements an Active Learning Cycle with 20 iterations using a Logistic Regression Classifier and Uncertainty Sampling. To use other classifiers, you can simply wrap classifiers from scikit-learn or use classifiers provided by scikit-activeml. Note that the main difficulty using active learning with scikit-learn is the ability to handle unlabeled data which we denote as a specific value (MISSING_LABEL) in the label vector y_true. More query strategies can be found in the documentation.
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.datasets import make_classification
from skactiveml.pool import UncertaintySampling
from skactiveml.utils import is_unlabeled, MISSING_LABEL
from skactiveml.classifier import SklearnClassifier
X, y_true = make_classification(random_state=0)
y = np.full(shape=y_true.shape, fill_value=MISSING_LABEL)
clf = SklearnClassifier(LogisticRegression(),
classes=np.unique(y_true))
qs = UncertaintySampling(clf, method='entropy')
n_cycles = 20
for c in range(n_cycles):
unlbld_idx = np.where(is_unlabeled(y))[0]
X_cand = X[unlbld_idx]
query_idx = unlbld_idx[qs.query(X_cand=X_cand, X=X, y=y)]
y[query_idx] = y_true[query_idx]
clf.fit(X, y)
Development
More information are available in the Developer’s Guide.
Documentation
The doumentation is available here: https://scikit-activeml.readthedocs.io
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scikit-activeml-0.0.0.tar.gz.
File metadata
- Download URL: scikit-activeml-0.0.0.tar.gz
- Upload date:
- Size: 61.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0123bdbb78638da88c6f02889e86b85b35ad32a0adcfccf6f80433275322eef
|
|
| MD5 |
d8ba3e752c8761644c261a714ffe1eb5
|
|
| BLAKE2b-256 |
fdfc927a8adb64038d787508a303b13f2fb5c63792e8eb0c9e078a1ca489511e
|
File details
Details for the file scikit_activeml-0.0.0-py3-none-any.whl.
File metadata
- Download URL: scikit_activeml-0.0.0-py3-none-any.whl
- Upload date:
- Size: 90.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d37e76aa1d9a46023ed1ad3b4b3a2a11993cc577891c46894625c97fc90c1d88
|
|
| MD5 |
2208da4b17dd4bb5076e26ed50ee4936
|
|
| BLAKE2b-256 |
291ca64d3738a8f1e4998af25442c6e7166fbe6045119fc2e8e556d1eacf7c14
|