Entropy of predictions of the for the provided samples. Args: classifier: The classifier for which the prediction entropy is to be measured. X: The samples for which the prediction entropy is to be measured. **predict_proba_kwargs: Keyword arguments to be passed for
(classifier: BaseEstimator, X: modALinput, **predict_proba_kwargs)
| 111 | |
| 112 | |
| 113 | def classifier_entropy(classifier: BaseEstimator, X: modALinput, **predict_proba_kwargs) -> np.ndarray: |
| 114 | """ |
| 115 | Entropy of predictions of the for the provided samples. |
| 116 | |
| 117 | Args: |
| 118 | classifier: The classifier for which the prediction entropy is to be measured. |
| 119 | X: The samples for which the prediction entropy is to be measured. |
| 120 | **predict_proba_kwargs: Keyword arguments to be passed for the :meth:`predict_proba` of the classifier. |
| 121 | |
| 122 | Returns: |
| 123 | Entropy of the class probabilities. |
| 124 | """ |
| 125 | try: |
| 126 | classwise_uncertainty = classifier.predict_proba(X, **predict_proba_kwargs) |
| 127 | except NotFittedError: |
| 128 | return np.zeros(shape=(X.shape[0], )) |
| 129 | |
| 130 | return np.transpose(entropy(np.transpose(classwise_uncertainty))) |
| 131 | |
| 132 | |
| 133 | def uncertainty_sampling(classifier: BaseEstimator, X: modALinput, |
no test coverage detected
searching dependent graphs…