{"id":14958342,"url":"https://github.com/scikit-activeml/scikit-activeml","last_synced_at":"2025-05-15T23:07:07.562Z","repository":{"id":37420000,"uuid":"283546804","full_name":"scikit-activeml/scikit-activeml","owner":"scikit-activeml","description":"scikit-activeml: Python library for active learning on top of scikit-learn","archived":false,"fork":false,"pushed_at":"2025-05-12T09:09:52.000Z","size":65063,"stargazers_count":164,"open_issues_count":24,"forks_count":19,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-12T10:28:03.370Z","etag":null,"topics":["active-learning","machine-learning","python","scikit-learn"],"latest_commit_sha":null,"homepage":"https://scikit-activeml.github.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scikit-activeml.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"docs/contributing.rst","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-07-29T16:19:30.000Z","updated_at":"2025-05-05T08:11:06.000Z","dependencies_parsed_at":"2023-02-19T17:01:03.302Z","dependency_job_id":"79a26bee-c761-4b48-b447-cd7d398ba19f","html_url":"https://github.com/scikit-activeml/scikit-activeml","commit_stats":{"total_commits":1603,"total_committers":22,"mean_commits":72.86363636363636,"dds":0.8041172800998129,"last_synced_commit":"6f5c7c0ccf8744466234f5884ebe3c9ed023af43"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scikit-activeml%2Fscikit-activeml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scikit-activeml%2Fscikit-activeml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scikit-activeml%2Fscikit-activeml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scikit-activeml%2Fscikit-activeml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scikit-activeml","download_url":"https://codeload.github.com/scikit-activeml/scikit-activeml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253719469,"owners_count":21952823,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["active-learning","machine-learning","python","scikit-learn"],"created_at":"2024-09-24T13:16:48.419Z","updated_at":"2025-05-15T23:07:01.971Z","avatar_url":"https://github.com/scikit-activeml.png","language":"Python","readme":".. intro_start\n\n|\n\n.. image:: https://raw.githubusercontent.com/scikit-activeml/scikit-activeml/master/docs/logos/scikit-activeml-logo.png\n   :class: dark-light\n   :align: center\n   :width: 40%\n\n|\n\n=====================================================================\nscikit-activeml: A Library and Toolbox for Active Learning Algorithms\n=====================================================================\n|Doc| |Codecov| |PythonVersion| |PyPi| |Black| |Downloads| |Paper|\n\n.. |Doc| image:: https://img.shields.io/badge/docs-latest-green\n   :target: https://scikit-activeml.github.io/scikit-activeml-docs/latest/\n\n.. |Codecov| image:: https://codecov.io/gh/scikit-activeml/scikit-activeml/branch/master/graph/badge.svg\n   :target: https://app.codecov.io/gh/scikit-activeml/scikit-activeml\n\n.. |PythonVersion| image:: https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue.svg\n   :target: https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10-blue\n\n.. |PyPi| image:: https://badge.fury.io/py/scikit-activeml.svg\n   :target: https://badge.fury.io/py/scikit-activeml\n\n.. |Paper| image:: https://img.shields.io/badge/paper-10.20944/preprints202103.0194.v1-blue.svg\n   :target: https://www.preprints.org/manuscript/202103.0194/v1\n\n.. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n   :target: https://github.com/psf/black\n\n.. |Downloads| image:: https://static.pepy.tech/badge/scikit-activeml\n   :target: https://www.pepy.tech/projects/scikit-activeml\n\nMachine learning models often need large amounts of training data to\nperform well. Whereas unlabeled data can be easily gathered, the labeling process\nis difficult, time-consuming, or expensive in most applications. Active learning can help solve\nthis problem by querying labels for those data samples improving the performance\nthe most. Thereby, the goal is that the learning algorithm performs sufficiently well with\nfewer labels. With this goal in mind, **scikit-activeml** has been developed as a Python library for active learning\non top of `scikit-learn \u003chttps://scikit-learn.org/stable/\u003e`_.\n\n.. intro_end\n\n.. user_installation_start\n\nUser Installation\n=================\n\nThe easiest way of installing scikit-activeml is using ``pip``:\n\n::\n\n    pip install -U scikit-activeml\n\nThe installation via `pip` defines only minimum requirements to avoid\npotential package downgrades withing your installation. If you encounter\nany incompatibility issues, you can downgrade packages by installing the\n`maximum requirements \u003chttps://github.com/scikit-activeml/scikit-activeml/blob/master/requirements_max.txt\u003e`_,\nwe tested at the release of the current package\nversion:\n\n::\n\n    pip install -r requirements_max.txt\n\n.. user_installation_end\n\n.. examples_start\n\nExamples\n========\nWe provide a broad overview of different use-cases in our `tutorial section \u003chttps://scikit-activeml.github.io/scikit-activeml-docs/latest/tutorials.html\u003e`_ offering\n\n- `Pool-based Active Learning - Getting Started \u003chttps://scikit-activeml.github.io/scikit-activeml-docs/latest/generated/tutorials/00_pool_getting_started.html\u003e`_,\n- `Deep Pool-based Active Learning - scikit-activeml with Skorch \u003chttps://scikit-activeml.github.io/scikit-activeml-docs/latest/generated/tutorials/01_deep_pool_al_with_skorch.html\u003e`_,\n- `Pool-based Active Learning for Regression - Getting Started \u003chttps://scikit-activeml.github.io/scikit-activeml-docs/latest/generated/tutorials/02_pool_regression_getting_started.html\u003e`_,\n- `Pool-based Active Learning - Sample Annotating \u003chttps://scikit-activeml.github.io/scikit-activeml-docs/latest/generated/tutorials/03_pool_oracle_annotations.html\u003e`_,\n- `Pool-based Active Learning - Simple Evaluation Study \u003chttps://scikit-activeml.github.io/scikit-activeml-docs/latest/generated/tutorials/04_pool_simple_evaluation_study.html\u003e`_,\n- `Active Image Classification via Self-supervised Learning \u003chttps://scikit-activeml.github.io/scikit-activeml-docs/latest/generated/tutorials/05_pool_al_with_self_supervised_learning.html\u003e`_,\n- `Multi-annotator Pool-based Active Learning - Getting Started \u003chttps://scikit-activeml.github.io/scikit-activeml-docs/latest/generated/tutorials/10_multiple_annotators_getting_started.html\u003e`_,\n- `Stream-based Active Learning - Getting Started \u003chttps://scikit-activeml.github.io/scikit-activeml-docs/latest/generated/tutorials/20_stream_getting_started.html\u003e`_,\n- `Batch Stream-based Active Learning with Pool Query Strategies \u003chttps://scikit-activeml.github.io/scikit-activeml-docs/latest/generated/tutorials/21_stream_batch_with_pool_al.html\u003e`_,\n- and `Stream-based Active Learning With River \u003chttps://scikit-activeml.github.io/scikit-activeml-docs/latest/generated/tutorials/22_river_classifier.html\u003e`_.\n\nTwo simple code snippets illustrating the straightforwardness of implementing active learning cycles with our Python package ``skactiveml`` are given in the following.\n\nPool-based Active Learning\n##########################\n\nThe following code snippet implements an active learning cycle with 20 iterations using a Gaussian process\nclassifier and uncertainty sampling. To use other classifiers, you can simply wrap classifiers from\n``sklearn`` or use classifiers provided by ``skactiveml``. Note that the main difficulty using\nactive learning with ``sklearn`` is the ability to handle unlabeled data, which we denote as a specific value\n(``MISSING_LABEL``) in the label vector ``y``. More query strategies can be found in the documentation.\n\n.. code-block:: python\n\n    import numpy as np\n    from sklearn.gaussian_process import GaussianProcessClassifier\n    from sklearn.datasets import make_blobs\n    from skactiveml.pool import UncertaintySampling\n    from skactiveml.utils import unlabeled_indices, MISSING_LABEL\n    from skactiveml.classifier import SklearnClassifier\n\n    # Generate data set.\n    X, y_true = make_blobs(n_samples=200, centers=4, random_state=0)\n    y = np.full(shape=y_true.shape, fill_value=MISSING_LABEL)\n\n    # Use the first 10 instances as initial training data.\n    y[:10] = y_true[:10]\n\n    # Create classifier and query strategy.\n    clf = SklearnClassifier(\n        GaussianProcessClassifier(random_state=0),\n        classes=np.unique(y_true),\n        random_state=0\n    )\n    qs = UncertaintySampling(method='entropy')\n\n    # Execute active learning cycle.\n    n_cycles = 20\n    for c in range(n_cycles):\n        query_idx = qs.query(X=X, y=y, clf=clf)\n        y[query_idx] = y_true[query_idx]\n\n    # Fit final classifier.\n    clf.fit(X, y)\n\nAs a result, we obtain an actively trained Gaussian process classifier.\nA corresponding visualization of its decision boundary (black line) and the\nsample utilities (greenish contours) is given below.\n\n.. image:: https://raw.githubusercontent.com/scikit-activeml/scikit-activeml/master/docs/logos/pal-example-output.png\n   :width: 400\n\nStream-based Active Learning\n############################\n\nThe following code snippet implements an active learning cycle with 200 data points and\nthe default budget of 10% using a pwc classifier and split uncertainty sampling.\nLike in the pool-based example you can wrap other classifiers from ``sklearn``,\n``sklearn`` compatible classifiers or like the example classifiers provided by ``skactiveml``.\n\n.. code-block:: python\n\n    import numpy as np\n    from sklearn.datasets import make_blobs\n    from skactiveml.classifier import ParzenWindowClassifier\n    from skactiveml.stream import Split\n    from skactiveml.utils import MISSING_LABEL\n\n    # Generate data set.\n    X, y_true = make_blobs(n_samples=200, centers=4, random_state=0)\n\n    # Create classifier and query strategy.\n    clf = ParzenWindowClassifier(random_state=0, classes=np.unique(y_true))\n    qs = Split(random_state=0)\n\n    # Initializing the training data as an empty array.\n    X_train = []\n    y_train = []\n\n    # Initialize the list that stores the result of the classifier's prediction.\n    correct_classifications = []\n\n    # Execute active learning cycle.\n    for x_t, y_t in zip(X, y_true):\n        X_cand = x_t.reshape([1, -1])\n        y_cand = y_t\n        clf.fit(X_train, y_train)\n        correct_classifications.append(clf.predict(X_cand)[0] == y_cand)\n        sampled_indices = qs.query(candidates=X_cand, clf=clf)\n        qs.update(candidates=X_cand, queried_indices=sampled_indices)\n        X_train.append(x_t)\n        y_train.append(y_cand if len(sampled_indices) \u003e 0 else MISSING_LABEL)\n\nAs a result, we obtain an actively trained Parzen window classifier.\nA corresponding visualization of its accuracy curve accross the active learning\ncycle is given below.\n\n.. image:: https://raw.githubusercontent.com/scikit-activeml/scikit-activeml/master/docs/logos/stream-example-output.png\n   :width: 400\n\nQuery Strategy Overview\n#######################\n\nFor better orientation, we provide an `overview \u003chttps://scikit-activeml.github.io/scikit-activeml-docs/latest/generated/strategy_overview.html\u003e`_\n(incl. paper references and `visual examples \u003chttps://scikit-activeml.github.io/scikit-activeml-docs/latest/generated/sphinx_gallery_examples/index.html\u003e`_)\nof the query strategies implemented by ``skactiveml``.\n\n|Overview| |Visualization|\n\n.. |Overview| image:: https://raw.githubusercontent.com/scikit-activeml/scikit-activeml/master/docs/logos/strategy-overview.gif\n   :width: 365\n\n.. |Visualization| image:: https://raw.githubusercontent.com/scikit-activeml/scikit-activeml/master/docs/logos/example-overview.gif\n   :width: 365\n\n.. examples_end\n\n.. citing_start\n\nCiting\n======\nIf you use ``skactiveml`` in one of your research projects and find it helpful,\nplease cite the following:\n\n::\n\n    @article{skactiveml2021,\n        title={scikit-activeml: {A} {L}ibrary and {T}oolbox for {A}ctive {L}earning {A}lgorithms},\n        author={Daniel Kottke and Marek Herde and Tuan Pham Minh and Alexander Benz and Pascal Mergard and Atal Roghman and Christoph Sandrock and Bernhard Sick},\n        journal={Preprints},\n        doi={10.20944/preprints202103.0194.v1},\n        year={2021},\n        url={https://github.com/scikit-activeml/scikit-activeml}\n    }\n\n.. citing_end\n","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscikit-activeml%2Fscikit-activeml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscikit-activeml%2Fscikit-activeml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscikit-activeml%2Fscikit-activeml/lists"}