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

Function min_confidence

modAL/multilabel.py:143–170  ·  view source on GitHub ↗

MinConfidence query strategy for multilabel classification. For more details on this query strategy, see Esuli and Sebastiani., Active Learning Strategies for Multi-Label Text Classification (http://dx.doi.org/10.1007/978-3-642-00958-7_12) Args: classifier: The multila

(classifier: OneVsRestClassifier, X_pool: modALinput,
                   n_instances: int = 1, random_tie_break: bool = False)

Source from the content-addressed store, hash-verified

141
142
143def min_confidence(classifier: OneVsRestClassifier, X_pool: modALinput,
144 n_instances: int = 1, random_tie_break: bool = False) -> np.ndarray:
145 """
146 MinConfidence query strategy for multilabel classification.
147
148 For more details on this query strategy, see
149 Esuli and Sebastiani., Active Learning Strategies for Multi-Label Text Classification
150 (http://dx.doi.org/10.1007/978-3-642-00958-7_12)
151
152 Args:
153 classifier: The multilabel classifier for which the labels are to be queried.
154 X_pool: The pool of samples to query from.
155 random_tie_break: If True, shuffles utility scores to randomize the order. This
156 can be used to break the tie when the highest utility score is not unique.
157
158 Returns:
159 The index of the instance from X_pool chosen to be labelled.
160 The minimal confidence metric of the chosen instance.
161
162 """
163
164 classwise_confidence = classifier.predict_proba(X_pool)
165 classwise_min = np.min(classwise_confidence, axis=1)
166
167 if not random_tie_break:
168 return multi_argmin(classwise_min, n_instances)
169
170 return shuffled_argmin(classwise_min, n_instances)
171
172
173def avg_confidence(classifier: OneVsRestClassifier, X_pool: modALinput,

Callers

nothing calls this directly

Calls 3

multi_argminFunction · 0.90
shuffled_argminFunction · 0.90
predict_probaMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…