skactiveml.utils.simple_batch#

skactiveml.utils.simple_batch(utilities, random_state=None, batch_size=1, return_utilities=False, method='max')[source]#

Generates a batch by selecting the highest values in the utilities. If utilities is an ND-array, the returned utilities will be an (N+1)D-array, with the shape batch_size x len(utilities), filled the given utilities but set the n-th highest values in the n-th row to np.nan.

Parameters
utilitiesnp.ndarray

The utilities to be used to create the batch.

random_stateint, RandomState instance or None, default=None

The random state to use.

batch_sizeint, default=1

The number of samples to be selected in one AL cycle.

return_utilitiesbool, default=False

If True, the utilities are returned.

methodstr, default=’max’

Determines how to select ‘best_indices’. ‘max’ selects the indices with the maximum utilities. ‘proportional’ randomly choose the ‘best_indices’ with the probabilities proportional to ‘utilities’.

Returns
best_indicesnp.ndarray of shape (batch_size,) if utilities.ndim == 1 else (batch_size, utilities.ndim)

The indices of the batch samples.

batch_utilitiesnp.ndarray of shape (batch_size, len(utilities))

The utilities of the batch (if return_utilities=True).

Examples using skactiveml.utils.simple_batch#

Dual Strategy for Active Learning

Dual Strategy for Active Learning