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

Function consensus_entropy_sampling

modAL/disagreement.py:130–155  ·  view source on GitHub ↗

Consensus entropy 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 th

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

Source from the content-addressed store, hash-verified

128
129
130def consensus_entropy_sampling(committee: BaseCommittee, X: modALinput,
131 n_instances: int = 1, random_tie_break=False,
132 **disagreement_measure_kwargs) -> np.ndarray:
133 """
134 Consensus entropy sampling strategy.
135
136 Args:
137 committee: The committee for which the labels are to be queried.
138 X: The pool of samples to query from.
139 n_instances: Number of samples to be queried.
140 random_tie_break: If True, shuffles utility scores to randomize the order. This
141 can be used to break the tie when the highest utility score is not unique.
142 **disagreement_measure_kwargs: Keyword arguments to be passed for the disagreement
143 measure function.
144
145 Returns:
146 The indices of the instances from X chosen to be labelled.
147 The disagrerment metric of the chosen instances.
148
149 """
150 disagreement = consensus_entropy(committee, X, **disagreement_measure_kwargs)
151
152 if not random_tie_break:
153 return multi_argmax(disagreement, n_instances=n_instances)
154
155 return shuffled_argmax(disagreement, n_instances=n_instances)
156
157
158def max_disagreement_sampling(committee: BaseCommittee, X: modALinput,

Callers

nothing calls this directly

Calls 3

multi_argmaxFunction · 0.90
shuffled_argmaxFunction · 0.90
consensus_entropyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…