From d9e1032c9edba1d7e743032a021238343e6a715f Mon Sep 17 00:00:00 2001 From: Paul Koch Date: Tue, 24 Dec 2024 02:06:43 -0800 Subject: [PATCH] handle the scenario where there is one continuous bin and either missing or unseen bins --- shared/libebm/PartitionOneDimensionalBoosting.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/shared/libebm/PartitionOneDimensionalBoosting.cpp b/shared/libebm/PartitionOneDimensionalBoosting.cpp index 4de6a050c..56ca79c3c 100644 --- a/shared/libebm/PartitionOneDimensionalBoosting.cpp +++ b/shared/libebm/PartitionOneDimensionalBoosting.cpp @@ -785,8 +785,21 @@ template class PartitionOneDimensionalBoo // we can only sort if there's a single sortable index, so 1 score value bNominal = 1 == cCompilerScores && bNominal && (0 == (TermBoostFlags_DisableCategorical & flags)); + size_t cNormalBins = cBins; + if(bMissing) { + --cNormalBins; + } + if(bUnseen) { + --cNormalBins; + } + if(cNormalBins <= 1) { + // we could have just missing and unknown bins an no normal bins, or a normal bin plus missing and/or unseen. + bMissing = false; + bUnseen = false; + } + // Disable missing if there are only 2 bins, because we'll end up just combining the bins always then. - bMissing = bMissing && 2 != cBins && (0 == (TermBoostFlags_MissingLow & flags)); + bMissing = bMissing && (0 == (TermBoostFlags_MissingLow & flags)); auto* const aBins = pBoosterShell->GetBoostingMainBins()