From e44b3a6d79b2e7b9b6c896238709bbf94e61c4d5 Mon Sep 17 00:00:00 2001 From: Paul Koch Date: Tue, 24 Dec 2024 13:46:43 -0800 Subject: [PATCH] tweaking code in tree building for future work --- .../PartitionOneDimensionalBoosting.cpp | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/shared/libebm/PartitionOneDimensionalBoosting.cpp b/shared/libebm/PartitionOneDimensionalBoosting.cpp index f1ceb8840..4fc40f096 100644 --- a/shared/libebm/PartitionOneDimensionalBoosting.cpp +++ b/shared/libebm/PartitionOneDimensionalBoosting.cpp @@ -253,13 +253,6 @@ static ErrorEbm Flatten(BoosterShell* const pBoosterShell, } EBM_ASSERT(!bNominal); - // for Nominal we cut everywhere - if(TermBoostFlags_MissingLow & flags) { - if(nullptr == pMissingBin) { - pMissingBin = pTreeNode->GetBin(); - } - } - // if !bNominal, check the bin above and below for order EBM_ASSERT(apBins == ppBinLast || *(ppBinLast - 1) < *ppBinLast); EBM_ASSERT(ppBinLast == apBins + (cBins - (nullptr != pMissingValueTreeNode ? size_t{2} : size_t{1})) || @@ -267,7 +260,18 @@ static ErrorEbm Flatten(BoosterShell* const pBoosterShell, iEdge = ppBinLast - apBins + 1 + (nullptr != pMissingValueTreeNode ? 1 : 0); - if(!bMissing || !(TermBoostFlags_MissingLow & flags) || ((TermBoostFlags_MissingLow & flags) && 1 != iEdge)) { + while(true) { // not a real loop + if(bMissing) { + if((TermBoostFlags_MissingLow & flags)) { + if(nullptr == pMissingBin) { + pMissingBin = pTreeNode->GetBin(); + } + if(1 == iEdge) { + break; + } + } + } + while(true) { iScore = 0; do { @@ -304,6 +308,8 @@ static ErrorEbm Flatten(BoosterShell* const pBoosterShell, const size_t iBin = CountBins(pBinCur, aBins, cBytesPerBin); pUpdateScore = aUpdateScore + iBin * cScores; } + + break; } pTreeNode = pParent;