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

Function vote_entropy_sampling

modAL/disagreement.py:102–127  ·  view source on GitHub ↗

Vote 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 the ord

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

Source from the content-addressed store, hash-verified

100
101
102def vote_entropy_sampling(committee: BaseCommittee, X: modALinput,
103 n_instances: int = 1, random_tie_break=False,
104 **disagreement_measure_kwargs) -> np.ndarray:
105 """
106 Vote entropy sampling strategy.
107
108 Args:
109 committee: The committee for which the labels are to be queried.
110 X: The pool of samples to query from.
111 n_instances: Number of samples to be queried.
112 random_tie_break: If True, shuffles utility scores to randomize the order. This
113 can be used to break the tie when the highest utility score is not unique.
114 **disagreement_measure_kwargs: Keyword arguments to be passed for the disagreement
115 measure function.
116
117 Returns:
118 The indices of the instances from X chosen to be labelled.
119 The disagrerment metric of the chosen instances.
120
121 """
122 disagreement = vote_entropy(committee, X, **disagreement_measure_kwargs)
123
124 if not random_tie_break:
125 return multi_argmax(disagreement, n_instances=n_instances)
126
127 return shuffled_argmax(disagreement, n_instances=n_instances)
128
129
130def consensus_entropy_sampling(committee: BaseCommittee, X: modALinput,

Callers

nothing calls this directly

Calls 3

multi_argmaxFunction · 0.90
shuffled_argmaxFunction · 0.90
vote_entropyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…