From 68d2f84de336335f1db0f9336f1cc827be498560 Mon Sep 17 00:00:00 2001 From: Alejandro Moreo Date: Wed, 27 Nov 2024 17:43:22 +0100 Subject: [PATCH] bugfix in bayesian method; float conversion was needed --- quapy/method/aggregative.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quapy/method/aggregative.py b/quapy/method/aggregative.py index 4f7204d..2e0160d 100644 --- a/quapy/method/aggregative.py +++ b/quapy/method/aggregative.py @@ -869,13 +869,13 @@ class BayesianCC(AggregativeCrispQuantifier): :param data: a :class:`quapy.data.base.LabelledCollection` consisting of the training data """ pred_labels, true_labels = classif_predictions.Xy - self._n_and_c_labeled = confusion_matrix(y_true=true_labels, y_pred=pred_labels, labels=self.classifier.classes_) + self._n_and_c_labeled = confusion_matrix(y_true=true_labels, y_pred=pred_labels, labels=self.classifier.classes_).astype(float) def sample_from_posterior(self, classif_predictions): if self._n_and_c_labeled is None: raise ValueError("aggregation_fit must be called before sample_from_posterior") - n_c_unlabeled = F.counts_from_labels(classif_predictions, self.classifier.classes_) + n_c_unlabeled = F.counts_from_labels(classif_predictions, self.classifier.classes_).astype(float) self._samples = _bayesian.sample_posterior( n_c_unlabeled=n_c_unlabeled,