From 22e846f47f5e07cfa34271f154801e2dd4668e71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Monta=C3=B1ana=20G=C3=B3mez?= Date: Sun, 24 Aug 2025 12:44:09 +0200 Subject: [PATCH] Fix discrete feature discretizer once they are rediscretized in the algorithm --- .sonarlint/connectedMode.json | 3 ++- bayesnet/classifiers/Proposal.cc | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.sonarlint/connectedMode.json b/.sonarlint/connectedMode.json index 571b82d..f40bed9 100644 --- a/.sonarlint/connectedMode.json +++ b/.sonarlint/connectedMode.json @@ -1,4 +1,5 @@ { "sonarCloudOrganization": "rmontanana", - "projectKey": "rmontanana_BayesNet" + "projectKey": "rmontanana_BayesNet", + "region": "EU" } \ No newline at end of file diff --git a/bayesnet/classifiers/Proposal.cc b/bayesnet/classifiers/Proposal.cc index 1fc0572..8451bbe 100644 --- a/bayesnet/classifiers/Proposal.cc +++ b/bayesnet/classifiers/Proposal.cc @@ -101,6 +101,9 @@ namespace bayesnet { auto xvf_ptr = Xf.index({ index }).data_ptr(); auto xvf = std::vector(xvf_ptr, xvf_ptr + Xf.size(1)); discretizers[feature]->fit(xvf, yxv); + // Enables the discretizer in predict time, because now we have a discretizer fitted for this feature, + // either it was a numeric feature in the beginning or not + wasNumeric[index] = true; } if (upgrade) { // Discretize again X (only the affected indices) with the new fitted discretizers