MCPcopy Create free account
hub / github.com/modAL-python/modAL / shuffled_argmin

Function shuffled_argmin

modAL/utils/selection.py:37–52  ·  view source on GitHub ↗

Shuffles the values and sorts them afterwards. This can be used to break the tie when the highest utility score is not unique. The shuffle randomizes order, which is preserved by the mergesort algorithm. Args: values: Contains the values to be selected from. n_insta

(values: np.ndarray, n_instances: int = 1)

Source from the content-addressed store, hash-verified

35
36
37def shuffled_argmin(values: np.ndarray, n_instances: int = 1) -> np.ndarray:
38 """
39 Shuffles the values and sorts them afterwards. This can be used to break
40 the tie when the highest utility score is not unique. The shuffle randomizes
41 order, which is preserved by the mergesort algorithm.
42
43 Args:
44 values: Contains the values to be selected from.
45 n_instances: Specifies how many indices and values to return.
46 Returns:
47 The indices and values of the n_instances smallest values.
48 """
49
50 indexes, index_values = shuffled_argmax(-values, n_instances)
51
52 return indexes, -index_values
53
54
55def multi_argmax(values: np.ndarray, n_instances: int = 1) -> np.ndarray:

Callers 3

min_confidenceFunction · 0.90
margin_samplingFunction · 0.90
expected_error_reductionFunction · 0.90

Calls 1

shuffled_argmaxFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…