Predicts the probabilities of the classes for each sample and each learner. Args: X: The samples for which class probabilities are to be calculated. **predict_proba_kwargs: Keyword arguments for the :meth:`predict_proba` of the learners. Returns:
(self, X: modALinput, **predict_proba_kwargs)
| 596 | return prediction |
| 597 | |
| 598 | def vote_proba(self, X: modALinput, **predict_proba_kwargs) -> Any: |
| 599 | """ |
| 600 | Predicts the probabilities of the classes for each sample and each learner. |
| 601 | Args: |
| 602 | X: The samples for which class probabilities are to be calculated. |
| 603 | **predict_proba_kwargs: Keyword arguments for the :meth:`predict_proba` of the learners. |
| 604 | Returns: |
| 605 | Probabilities of each class for each learner and each instance. |
| 606 | """ |
| 607 | |
| 608 | # get dimensions |
| 609 | n_samples = X.shape[0] |
| 610 | n_learners = len(self.learner_list) |
| 611 | proba = np.zeros(shape=(n_samples, n_learners, self.n_classes_)) |
| 612 | |
| 613 | # checking if the learners in the Committee know the same set of class labels |
| 614 | if check_class_labels(*[learner.estimator for learner in self.learner_list]): |
| 615 | # known class labels are the same for each learner |
| 616 | # probability prediction is straightforward |
| 617 | |
| 618 | for learner_idx, learner in enumerate(self.learner_list): |
| 619 | proba[:, learner_idx, :] = learner.predict_proba(X, **predict_proba_kwargs) |
| 620 | |
| 621 | else: |
| 622 | for learner_idx, learner in enumerate(self.learner_list): |
| 623 | proba[:, learner_idx, :] = check_class_proba( |
| 624 | proba=learner.predict_proba(X, **predict_proba_kwargs), |
| 625 | known_labels=learner.estimator.classes_, |
| 626 | all_labels=self.classes_ |
| 627 | ) |
| 628 | |
| 629 | return proba |
| 630 | |
| 631 | |
| 632 | class CommitteeRegressor(BaseCommittee): |