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

Function multi_argmax

modAL/utils/selection.py:55–69  ·  view source on GitHub ↗

return the indices and values of the n_instances highest values. Args: values: Contains the values to be selected from. n_instances: Specifies how many indices and values to return. Returns: The indices and values of the n_instances largest values.

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

Source from the content-addressed store, hash-verified

53
54
55def multi_argmax(values: np.ndarray, n_instances: int = 1) -> np.ndarray:
56 """
57 return the indices and values of the n_instances highest values.
58
59 Args:
60 values: Contains the values to be selected from.
61 n_instances: Specifies how many indices and values to return.
62 Returns:
63 The indices and values of the n_instances largest values.
64 """
65 assert n_instances <= values.shape[0], 'n_instances must be less or equal than the size of utility'
66
67 max_idx = np.argpartition(-values, n_instances-1, axis=0)[:n_instances]
68
69 return max_idx, values[max_idx]
70
71
72def multi_argmin(values: np.ndarray, n_instances: int = 1) -> np.ndarray:

Callers 15

custom_query_strategyFunction · 0.90
max_lossFunction · 0.90
mean_max_lossFunction · 0.90
avg_confidenceFunction · 0.90
max_scoreFunction · 0.90
avg_scoreFunction · 0.90
vote_entropy_samplingFunction · 0.90
max_std_samplingFunction · 0.90
mc_dropout_baldFunction · 0.90
mc_dropout_mean_stFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…