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 utilities.shape, 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 | np.random.RandomState (default=None)
The random state to use. If random_state is None random random_state is used.
- 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 index of the batch instance.
- batch_utilitiesnp.ndarray of shape (batch_size, len(utilities))
The utilities of the batch (if return_utilities=True).