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

Method predict

modAL/models/learners.py:540–554  ·  view source on GitHub ↗

Predicts the class of the samples by picking the consensus prediction. Args: X: The samples to be predicted. **predict_proba_kwargs: Keyword arguments to be passed to the :meth:`predict_proba` of the Committee. Returns: The predicted class

(self, X: modALinput, **predict_proba_kwargs)

Source from the content-addressed store, hash-verified

538 self._set_classes()
539
540 def predict(self, X: modALinput, **predict_proba_kwargs) -> Any:
541 """
542 Predicts the class of the samples by picking the consensus prediction.
543 Args:
544 X: The samples to be predicted.
545 **predict_proba_kwargs: Keyword arguments to be passed to the :meth:`predict_proba` of the Committee.
546 Returns:
547 The predicted class labels for X.
548 """
549 # getting average certainties
550 proba = self.predict_proba(X, **predict_proba_kwargs)
551 # finding the sample-wise max probability
552 max_proba_idx = np.argmax(proba, axis=1)
553 # translating label indices to labels
554 return self.classes_[max_proba_idx]
555
556 def predict_proba(self, X: modALinput, **predict_proba_kwargs) -> Any:
557 """

Callers 3

scoreMethod · 0.95
voteMethod · 0.45
voteMethod · 0.45

Calls 1

predict_probaMethod · 0.95

Tested by

no test coverage detected