Entropy sampling query strategy. Selects the instances where the class probabilities have the largest entropy. Args: classifier: The classifier for which the labels are to be queried. X: The pool of samples to query from. n_instances: Number of samples to be que
(classifier: BaseEstimator, X: modALinput,
n_instances: int = 1, random_tie_break: bool = False,
**uncertainty_measure_kwargs)
| 184 | |
| 185 | |
| 186 | def entropy_sampling(classifier: BaseEstimator, X: modALinput, |
| 187 | n_instances: int = 1, random_tie_break: bool = False, |
| 188 | **uncertainty_measure_kwargs) -> np.ndarray: |
| 189 | """ |
| 190 | Entropy sampling query strategy. Selects the instances where the class probabilities |
| 191 | have the largest entropy. |
| 192 | |
| 193 | Args: |
| 194 | classifier: The classifier for which the labels are to be queried. |
| 195 | X: The pool of samples to query from. |
| 196 | n_instances: Number of samples to be queried. |
| 197 | random_tie_break: If True, shuffles utility scores to randomize the order. This |
| 198 | can be used to break the tie when the highest utility score is not unique. |
| 199 | **uncertainty_measure_kwargs: Keyword arguments to be passed for the uncertainty |
| 200 | measure function. |
| 201 | |
| 202 | Returns: |
| 203 | The indices of the instances from X chosen to be labelled. |
| 204 | The entropy metric of the chosen instances. |
| 205 | """ |
| 206 | entropy = classifier_entropy(classifier, X, **uncertainty_measure_kwargs) |
| 207 | |
| 208 | if not random_tie_break: |
| 209 | return multi_argmax(entropy, n_instances=n_instances) |
| 210 | |
| 211 | return shuffled_argmax(entropy, n_instances=n_instances) |
nothing calls this directly
no test coverage detected
searching dependent graphs…