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

Function max_disagreement_sampling

modAL/disagreement.py:158–183  ·  view source on GitHub ↗

Maximum disagreement sampling strategy. Args: committee: The committee for which the labels are to be queried. X: The pool of samples to query from. n_instances: Number of samples to be queried. random_tie_break: If True, shuffles utility scores to randomize

(committee: BaseCommittee, X: modALinput,
                              n_instances: int = 1, random_tie_break=False,
                              **disagreement_measure_kwargs)

Source from the content-addressed store, hash-verified

156
157
158def max_disagreement_sampling(committee: BaseCommittee, X: modALinput,
159 n_instances: int = 1, random_tie_break=False,
160 **disagreement_measure_kwargs) -> np.ndarray:
161 """
162 Maximum disagreement sampling strategy.
163
164 Args:
165 committee: The committee for which the labels are to be queried.
166 X: The pool of samples to query from.
167 n_instances: Number of samples to be queried.
168 random_tie_break: If True, shuffles utility scores to randomize the order. This
169 can be used to break the tie when the highest utility score is not unique.
170 **disagreement_measure_kwargs: Keyword arguments to be passed for the disagreement
171 measure function.
172
173 Returns:
174 The indices of the instances from X chosen to be labelled.
175 The disagrerment metric of the chosen instances.
176
177 """
178 disagreement = KL_max_disagreement(committee, X, **disagreement_measure_kwargs)
179
180 if not random_tie_break:
181 return multi_argmax(disagreement, n_instances=n_instances)
182
183 return shuffled_argmax(disagreement, n_instances=n_instances)
184
185
186def max_std_sampling(regressor: BaseEstimator, X: modALinput,

Callers

nothing calls this directly

Calls 3

multi_argmaxFunction · 0.90
shuffled_argmaxFunction · 0.90
KL_max_disagreementFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…