modAL.multilabel¶
-
modAL.multilabel.
SVM_binary_minimum
(classifier: modAL.models.learners.ActiveLearner, X_pool: Union[list, numpy.ndarray, scipy.sparse.csr.csr_matrix], random_tie_break: bool = False) → Tuple[numpy.ndarray, Union[list, numpy.ndarray, scipy.sparse.csr.csr_matrix]][source]¶ 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)
Parameters: - classifier – The multilabel classifier for which the labels are to be queried. Must be an SVM model such as the ones from sklearn.svm.
- X_pool – The pool of samples to query from.
- random_tie_break – If True, shuffles utility scores to randomize the order. This can be used to break the tie when the highest utility score is not unique.
Returns: The index of the instance from X_pool chosen to be labelled; the instance from X_pool chosen to be labelled.
-
modAL.multilabel.
avg_confidence
(classifier: sklearn.multiclass.OneVsRestClassifier, X_pool: Union[list, numpy.ndarray, scipy.sparse.csr.csr_matrix], n_instances: int = 1, random_tie_break: bool = False) → Tuple[numpy.ndarray, Union[list, numpy.ndarray, scipy.sparse.csr.csr_matrix]][source]¶ AvgConfidence 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)
Parameters: - classifier – The multilabel classifier for which the labels are to be queried.
- X_pool – The pool of samples to query from.
- random_tie_break – If True, shuffles utility scores to randomize the order. This can be used to break the tie when the highest utility score is not unique.
Returns: The index of the instance from X_pool chosen to be labelled; the instance from X_pool chosen to be labelled.
-
modAL.multilabel.
avg_score
(classifier: sklearn.multiclass.OneVsRestClassifier, X_pool: Union[list, numpy.ndarray, scipy.sparse.csr.csr_matrix], n_instances: int = 1, random_tie_break: bool = False) → Tuple[numpy.ndarray, Union[list, numpy.ndarray, scipy.sparse.csr.csr_matrix]][source]¶ AvgScore 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)
Parameters: - classifier – The multilabel classifier for which the labels are to be queried.
- X_pool – The pool of samples to query from.
- random_tie_break – If True, shuffles utility scores to randomize the order. This can be used to break the tie when the highest utility score is not unique.
Returns: The index of the instance from X_pool chosen to be labelled; the instance from X_pool chosen to be labelled.
-
modAL.multilabel.
max_loss
(classifier: sklearn.multiclass.OneVsRestClassifier, X_pool: Union[list, numpy.ndarray, scipy.sparse.csr.csr_matrix], n_instances: int = 1, random_tie_break: bool = False) → Tuple[numpy.ndarray, Union[list, numpy.ndarray, scipy.sparse.csr.csr_matrix]][source]¶ Max Loss query strategy for SVM multilabel classification.
For more details on this query strategy, see Li et al., Multilabel SVM active learning for image classification (http://dx.doi.org/10.1109/ICIP.2004.1421535)
Parameters: - classifier – The multilabel classifier for which the labels are to be queried. Should be an SVM model such as the ones from sklearn.svm. Although the function will execute for other models as well, the mathematical calculations in Li et al. work only for SVM-s.
- X_pool – The pool of samples to query from.
- random_tie_break – If True, shuffles utility scores to randomize the order. This can be used to break the tie when the highest utility score is not unique.
Returns: The index of the instance from X_pool chosen to be labelled; the instance from X_pool chosen to be labelled.
-
modAL.multilabel.
max_score
(classifier: sklearn.multiclass.OneVsRestClassifier, X_pool: Union[list, numpy.ndarray, scipy.sparse.csr.csr_matrix], n_instances: int = 1, random_tie_break: bool = 1) → Tuple[numpy.ndarray, Union[list, numpy.ndarray, scipy.sparse.csr.csr_matrix]][source]¶ MaxScore 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)
Parameters: - classifier – The multilabel classifier for which the labels are to be queried.
- X_pool – The pool of samples to query from.
- random_tie_break – If True, shuffles utility scores to randomize the order. This can be used to break the tie when the highest utility score is not unique.
Returns: The index of the instance from X_pool chosen to be labelled; the instance from X_pool chosen to be labelled.
-
modAL.multilabel.
mean_max_loss
(classifier: sklearn.multiclass.OneVsRestClassifier, X_pool: Union[list, numpy.ndarray, scipy.sparse.csr.csr_matrix], n_instances: int = 1, random_tie_break: bool = False) → Tuple[numpy.ndarray, Union[list, numpy.ndarray, scipy.sparse.csr.csr_matrix]][source]¶ Mean Max Loss query strategy for SVM multilabel classification.
For more details on this query strategy, see Li et al., Multilabel SVM active learning for image classification (http://dx.doi.org/10.1109/ICIP.2004.1421535)
Parameters: - classifier – The multilabel classifier for which the labels are to be queried. Should be an SVM model such as the ones from sklearn.svm. Although the function will execute for other models as well, the mathematical calculations in Li et al. work only for SVM-s.
- X_pool – The pool of samples to query from.
- random_tie_break – If True, shuffles utility scores to randomize the order. This can be used to break the tie when the highest utility score is not unique.
Returns: The index of the instance from X_pool chosen to be labelled; the instance from X_pool chosen to be labelled.
-
modAL.multilabel.
min_confidence
(classifier: sklearn.multiclass.OneVsRestClassifier, X_pool: Union[list, numpy.ndarray, scipy.sparse.csr.csr_matrix], n_instances: int = 1, random_tie_break: bool = False) → Tuple[numpy.ndarray, Union[list, numpy.ndarray, scipy.sparse.csr.csr_matrix]][source]¶ 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)
Parameters: - classifier – The multilabel classifier for which the labels are to be queried.
- X_pool – The pool of samples to query from.
- random_tie_break – If True, shuffles utility scores to randomize the order. This can be used to break the tie when the highest utility score is not unique.
Returns: The index of the instance from X_pool chosen to be labelled; the instance from X_pool chosen to be labelled.