Skip to content

Commit

Permalink
tweaking code in tree building for future work
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbkoch committed Dec 24, 2024
1 parent 9b723a0 commit e44b3a6
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions shared/libebm/PartitionOneDimensionalBoosting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,21 +253,25 @@ 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})) ||
*ppBinLast < *(ppBinLast + 1));

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 {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit e44b3a6

Please sign in to comment.