cardinal.base¶
Classes¶
- class cardinal.base.BaseQuerySampler(batch_size: int)[source]¶
Abstract Base Class for query samplers
A query sampler is an object that takes as input labeled and/or unlabeled samples and use knowledge from them to selected the most informative ones.
- Parameters
batch_size – Numbers of samples to select.
- class cardinal.base.ScoredQuerySampler(batch_size: int, strategy: str = 'top', random_state: Optional[Union[RandomState, int]] = None)[source]¶
Abstract Base Class handling query samplers relying on a total order. Query sampling methods often scores all the samples and then pick samples using these scores. This base class handles the selection system, only a scoring method is then required.
- Parameters
batch_size – Numbers of samples to select.
strategy – Describes how to select the samples based on scores. Can be “top”, “weighted”.
random_state – Random seeding
- abstract score_samples(X: array) array [source]¶
Give an informativeness score to unlabeled samples.
- Parameters
X – Samples to evaluate.
- Returns
Scores of the samples.
- select_samples(X: array) array [source]¶
Selects the samples from unlabeled data using the internal scoring.
- Parameters
X – Pool of unlabeled samples of shape (n_samples, n_features).
strategy – Strategy to use to select queries. Can be one of top, linear_choice, or squared_choice.
- Returns
Indices of the selected samples of shape (batch_size).