API Reference#

This is an overview of the API.

skactiveml.base:#

The skactiveml.base package implements the base classes for skactiveml.

Classes#

base.QueryStrategy

Base class for all query strategies in scikit-activeml.

base.SingleAnnotatorPoolQueryStrategy

Base class for all pool-based active learning query strategies with a single annotator in scikit-activeml.

base.MultiAnnotatorPoolQueryStrategy

Base class for all pool-based active learning query strategies with multiple annotators in scikit-activeml.

base.BudgetManager

Base class for all budget managers for stream-based active learning in scikit-activeml to model budgeting constraints.

base.SingleAnnotatorStreamQueryStrategy

Base class for all stream-based active learning query strategies in scikit-activeml.

base.SkactivemlClassifier

Base class for scikit-activeml classifiers such that missing labels, user-defined classes, and cost-sensitive classification (i.e., cost matrix) can be handled.

base.ClassFrequencyEstimator

Extends scikit-activeml classifiers to estimators that are able to estimate class frequencies for given samples (by calling 'predict_freq').

base.AnnotatorModelMixin

Base class of all annotator models estimating the performances of annotators for given samples.

base.SkactivemlRegressor

Base class for scikit-activeml regressors.

base.ProbabilisticRegressor

Base class for scikit-activeml probabilistic regressors.

skactiveml.pool:#

The skactiveml.pool package implements query strategies for pool-based active learning.

Classes#

pool.RandomSampling

Random Sampling.

pool.ProbabilisticAL

(Multi-class) Probabilistic Active Learning

pool.UncertaintySampling

Uncertainty Sampling.

pool.EpistemicUncertaintySampling

Epistemic Uncertainty Sampling.

pool.MonteCarloEER

This class implements the expected error method from [1] that uses a Monte-Carlo approach to estimate the error.

pool.ValueOfInformationEER

This class implements the expected error method from [1] that estimates the value of information.

pool.QueryByCommittee

Query-by-Committee (QBC)

pool.Quire

Implementation of the AL strategy "QUerying Informative and Representative Examples" (QUIRE for short) [1].

pool.FourDs

Implementation of the pool-based query strategy 4DS for training a MixtureModelClassifier [1].

pool.CostEmbeddingAL

Active Learning with Cost Embedding (ALCE).

pool.ExpectedModelChangeMaximization

Expected Model Change.

pool.ExpectedModelOutputChange

Regression based Expected Model Output Change.

pool.ExpectedModelVarianceReduction

Expected Model Variance Reduction.

pool.KLDivergenceMaximization

Regression based Kullback Leibler Divergence Maximization.

pool.GreedySamplingX

Greedy Sampling on the feature space.

pool.GreedySamplingTarget

Greedy Sampling on the target space.

pool.DiscriminativeAL

Discriminative Active Learning.

pool.BatchBALD

Batch Bayesian Active Learning by Disagreement (BatchBALD)

pool.Clue

Clustering Uncertainty-weighted Embeddings (CLUE)

pool.CoreSet

Core Set

pool.TypiClust

Typical Clustering

pool.Badge

Batch Active Learning by Diverse Gradient Embedding (BADGE)

pool.ProbCover

Probability Coverage

pool.ContrastiveAL

Contrastive Active Learning (ContrastiveAL)

pool.GreedyBALD

Greedy Bayesian Active Learning by Disagreement (GreedyBALD)

pool.RegressionTreeBasedAL

Regression Tree-based Active Learning

pool.SubSamplingWrapper

Sub-sampling Wrapper.

pool.ParallelUtilityEstimationWrapper

Parallel Utility Estimation Wrapper.

Functions#

pool.cost_reduction

Calculate the expected cost reduction.

pool.uncertainty_scores

Computes uncertainty scores.

pool.expected_average_precision

Calculate the expected average precision.

pool.average_kl_divergence

Calculates the average Kullback-Leibler (KL) divergence for measuring the level of disagreement in QueryByCommittee.

pool.vote_entropy

Calculates the vote entropy for measuring the level of disagreement in QueryByCommittee.

pool.variation_ratios

Calculates the variation ratios for measuring the level of disagreement in QueryByCommittee.

pool.batch_bald

BatchBALD: Efficient and Diverse Batch Acquisition for Deep Bayesian Active Learning

pool.k_greedy_center

An active learning method that greedily forms a batch to minimize the maximum distance to a cluster center among all unlabeled datapoints.

skactiveml.pool.multiannotator:#

The skactiveml.pool.multiannotator package implements multi annotator pool-based active learning for multiple annotators.

Classes#

pool.multiannotator.IntervalEstimationThreshold

The strategy 'Interval Estimation Threshold' (IEThresh) [1] is useful for addressing the exploration vs.

pool.multiannotator.IntervalEstimationAnnotModel

This annotator model relies on 'Interval Estimation Learning' (IELearning) for estimating the annotation performances, i.e., labeling accuracies, of multiple annotators [1].

pool.multiannotator.SingleAnnotatorWrapper

Implementation of a wrapper class for pool-based active learning query strategies with a single annotator such that it transforms the query strategy for the single annotator into a query strategy for multiple annotators by choosing an annotator randomly or according to the parameter A_pef and setting the labeled matrix to a labeled vector by an aggregation function, e.g., majority voting.

skactiveml.pool.utils:#

Classes#

pool.utils.IndexClassifierWrapper

Classifier to simplify retraining classifiers in an active learning scenario.

skactiveml.stream:#

The skactiveml.stream module implements query strategies for stream-based active learning.

Classes#

stream.StreamRandomSampling

Random Sampling for Datastreams.

stream.PeriodicSampling

The PeriodicSampling samples instances periodically.

stream.FixedUncertainty

The FixedUncertainty (Fixed-Uncertainty in [1]) query strategy samples instances based on the classifiers uncertainty assessed based on the classifier's predictions.

stream.VariableUncertainty

The VariableUncertainty (Var-Uncertainty in [1]) query strategy samples instances based on the classifiers uncertainty assessed based on the classifier's predictions.

stream.Split

The Split [1] query strategy samples in 100*v% of instances randomly and in 100*(1-v)% of cases according to VariableUncertainty.

stream.StreamProbabilisticAL

Probabilistic Active Learning in Datastreams (StreamProbabilisticAL) is an extension to Multi-Class Probabilistic Active Learning (McPAL) (see pool.ProbabilisticAL).

stream.RandomVariableUncertainty

The RandomVariableUncertainty (Ran-Var-Uncertainty in [1]) query strategy samples instances based on the classifier's uncertainty assessed based on the classifier's predictions.

stream.StreamDensityBasedAL

The StreamDensityBasedAL [1] query strategy is an extension to the uncertainty based query strategies proposed by Žliobaitė et al. [2].

stream.CognitiveDualQueryStrategy

This class is the base for the CognitiveDualQueryStrategy query strategy proposed in [1].

stream.CognitiveDualQueryStrategyRan

This class implements the CognitiveDualQueryStrategy strategy with Random Sampling.

stream.CognitiveDualQueryStrategyRanVarUn

This class implements the CognitiveDualQueryStrategy strategy with RandomVariableUncertainty.

stream.CognitiveDualQueryStrategyVarUn

This class implements the CognitiveDualQueryStrategy strategy with VariableUncertainty.

stream.CognitiveDualQueryStrategyFixUn

This class implements the CognitiveDualQueryStrategy strategy with FixedUncertainty.

skactiveml.stream.budgetmanager:#

The skactiveml.stream.budgetmanager module implements budget managers, which are capable of modeling the budget constraints in stream-based active learning settings.

Classes#

stream.budgetmanager.EstimatedBudgetZliobaite

Budget manager which checks, whether the specified budget has been exhausted already.

stream.budgetmanager.FixedUncertaintyBudgetManager

Budget manager which is optimized for FixedUncertainty and checks, whether the specified budget has been exhausted already.

stream.budgetmanager.VariableUncertaintyBudgetManager

Budget manager which checks, whether the specified budget has been exhausted already.

stream.budgetmanager.SplitBudgetManager

Budget manager which checks, whether the specified budget has been exhausted already.

stream.budgetmanager.BalancedIncrementalQuantileFilter

The Balanced Incremental Quantile Filter has been proposed together with Probabilistic Active Learning for Datastreams [1].

stream.budgetmanager.RandomVariableUncertaintyBudgetManager

Budget manager which checks, whether the specified budget has been exhausted already.

stream.budgetmanager.DensityBasedSplitBudgetManager

Budget manager which checks, whether the specified budget has been exhausted already.

stream.budgetmanager.RandomBudgetManager

Budget manager which checks, whether the specified budget has been exhausted already.

skactiveml.classifier:#

The skactiveml.classifier module.

Classes#

classifier.ParzenWindowClassifier

The Parzen window classifier (PWC) is a simple and probabilistic classifier.

classifier.MixtureModelClassifier

The classifier based on a mixture model (MixtureModelClassifier) is a generative classifier based on a (Bayesian) Gaussian mixture model (GMM).

classifier.SklearnClassifier

Implementation of a wrapper class for scikit-learn classifiers such that missing labels can be handled.

classifier.SlidingWindowClassifier

Implementation of a wrapper class for SkactivemlClassifier such that the number of training samples can be limited to the latest window_size samples.

skactiveml.classifier.multiannotator:#

Classes#

classifier.multiannotator.AnnotatorLogisticRegression

Logistic Regression based on Raykar [1] is a classification algorithm that learns from multiple annotators.

classifier.multiannotator.AnnotatorEnsembleClassifier

This strategy consists of fitting one classifier per annotator.

skactiveml.visualization:#

The skactiveml.visualization module includes various tools for visualization.

Functions#

visualization.plot_utilities

Plot the utility for the given single-annotator query strategy.

visualization.plot_decision_boundary

Plot the decision boundary of the given classifier.

visualization.plot_contour_for_samples

Plot the utility for the given query strategy.

visualization.plot_annotator_utilities

Plot the utility for the given query strategy.

visualization.plot_stream_training_data

Plot the utility for the given query strategy.

visualization.plot_stream_decision_boundary

Plot the decision boundary of the given classifier.

visualization.mesh

Function to get instances of a mesh grid as well as x-mesh and y-mesh with given resolution in the specified bounds.

skactiveml.utils:#

The skactiveml.utils module includes various utilities.

Classes#

utils.ExtLabelEncoder

Encode class labels with value between 0 and classes-1 and uses -1 for unlabeled samples.

Functions#

utils.rand_argmax

Returns index of maximum value.

utils.rand_argmin

Returns index of minimum value.

utils.compute_vote_vectors

Counts number of votes per class label for each sample.

utils.majority_vote

Assigns a label to each sample based on weighted voting.

utils.is_unlabeled

Creates a boolean mask indicating missing labels.

utils.is_labeled

Creates a boolean mask indicating present labels.

utils.check_classes

Check whether class labels are uniformly strings or numbers.

utils.check_missing_label

Check whether a missing label is compatible to a given target type.

utils.check_cost_matrix

Check whether cost matrix has shape (n_classes, n_classes).

utils.check_scalar

Validate scalar parameters type and value.

utils.check_classifier_params

Check whether the parameters are compatible to each other (only if classes is not None).

utils.check_X_y

Input validation for standard estimators.

utils.check_random_state

Check validity of the given random state.

utils.call_func

Calls a function with the given parameters given in kwargs if they exist as parameters in f_callable.

utils.match_signature

A decorator that matches the signature to a given method from a reference and hides it when the reference object does not have the wrapped function.

utils.check_class_prior

Check if the class_prior is a valid prior.

utils.ext_confusion_matrix

Compute confusion matrix to evaluate the accuracy of a classification.

utils.labeled_indices

Return an array of indices indicating present labels.

utils.unlabeled_indices

Return an array of indices indicating missing labels.

utils.check_type

Check if obj is one of the given types.

utils.check_bound

Validates bound and returns the bound of X if bound is None.

utils.check_equal_missing_label

Check whether two missing label values are equal to each other.

utils.check_budget_manager

Validate if budget manager is a budgetmanager class and create a copy 'budget_manager_'.

utils.check_indices

Check if indices fit to array.

utils.simple_batch

Generates a batch by selecting the highest values in the 'utilities'.

utils._check_callable

Checks if function is a callable and if the number of free parameters is correct.

skactiveml.exceptions:#

Classes#

exceptions.MappingError

Exception class to raise if a strategy needs a mapping between samples and candidates which is not available.