SVM binary minimum multilabel active learning strategy. For details see the paper Klaus Brinker, On Active Learning in Multi-label Classification (https://link.springer.com/chapter/10.1007%2F3-540-31314-1_24) Args: classifier: The multilabel classifier for which the labels
(classifier: ActiveLearner, X_pool: modALinput,
random_tie_break: bool = False)
| 42 | |
| 43 | |
| 44 | def SVM_binary_minimum(classifier: ActiveLearner, X_pool: modALinput, |
| 45 | random_tie_break: bool = False) -> np.ndarray: |
| 46 | """ |
| 47 | SVM binary minimum multilabel active learning strategy. For details see the paper |
| 48 | Klaus Brinker, On Active Learning in Multi-label Classification |
| 49 | (https://link.springer.com/chapter/10.1007%2F3-540-31314-1_24) |
| 50 | |
| 51 | Args: |
| 52 | classifier: The multilabel classifier for which the labels are to be queried. Must be an SVM model |
| 53 | such as the ones from sklearn.svm. |
| 54 | X_pool: The pool of samples to query from. |
| 55 | random_tie_break: If True, shuffles utility scores to randomize the order. This |
| 56 | can be used to break the tie when the highest utility score is not unique. |
| 57 | |
| 58 | Returns: |
| 59 | The index of the instance from X_pool chosen to be labelled; |
| 60 | The instance from X_pool chosen to be labelled. |
| 61 | The Minimum absolute distance metric of the chosen instance; |
| 62 | """ |
| 63 | |
| 64 | decision_function = np.array([svm.decision_function(X_pool) |
| 65 | for svm in classifier.estimator.estimators_]).T |
| 66 | |
| 67 | min_abs_dist = np.min(np.abs(decision_function), axis=1) |
| 68 | |
| 69 | if not random_tie_break: |
| 70 | return np.argmin(min_abs_dist) |
| 71 | |
| 72 | return shuffled_argmax(min_abs_dist) |
| 73 | |
| 74 | |
| 75 | def max_loss(classifier: OneVsRestClassifier, X_pool: modALinput, |
nothing calls this directly
no test coverage detected
searching dependent graphs…