Fix discrete feature discretizer once they are rediscretized in the algorithm

This commit is contained in:
2025-08-24 12:44:09 +02:00
parent 7c01646726
commit 22e846f47f
2 changed files with 5 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
{
"sonarCloudOrganization": "rmontanana",
"projectKey": "rmontanana_BayesNet"
"projectKey": "rmontanana_BayesNet",
"region": "EU"
}

View File

@@ -101,6 +101,9 @@ namespace bayesnet {
auto xvf_ptr = Xf.index({ index }).data_ptr<float>();
auto xvf = std::vector<mdlp::precision_t>(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