cardinal.batch

Classes

class cardinal.batch.RankedBatchSampler(batch_size: int, metric: str = 'euclidean')[source]

Selects samples to label by maximizing the distance between them.

Parameters
  • batch_size – Number of samples to select.

  • metric – Metric to use for distance computation.

fit(X: array, y: Optional[array] = None) RankedBatchSampler[source]

Does nothing, RankedBatch is unsupervised.

Parameters
  • X – Labeled samples of shape (n_samples, n_features).

  • y – Labels of shape (n_samples).

Returns

The object itself

select_samples(X: array, samples_weights: array) array[source]

Selects the samples to annotate from unlabelled data.

Parameters
  • X – Pool of unlabeled samples of shape (n_samples, n_features).

  • sample_weights – Weights of the samples of shape (n_samples).

Returns

Indices of the selected samples of shape (batch_size).