diff --git a/shared/libebm/PartitionOneDimensionalBoosting.cpp b/shared/libebm/PartitionOneDimensionalBoosting.cpp index a2d4a363c..770bb98a4 100644 --- a/shared/libebm/PartitionOneDimensionalBoosting.cpp +++ b/shared/libebm/PartitionOneDimensionalBoosting.cpp @@ -832,7 +832,10 @@ template class PartitionOneDimensionalBoo auto* const aBins = pBoosterShell->GetBoostingMainBins() ->Specialize(); - auto* const pBinsEnd = IndexBin(aBins, cBytesPerBin * cBins); + auto* pBinsEnd = IndexBin(aBins, cBytesPerBin * cBins); + + SumAllBins( + pBoosterShell, pBinsEnd, cSamplesTotal, weightTotal, pRootTreeNode->GetBin()); const Bin** const apBins = reinterpret_cast**>( @@ -844,7 +847,6 @@ template class PartitionOneDimensionalBoo const Bin* pMissingBin = nullptr; bool bMissingIsolated = false; - size_t cBinsAdjusted = cBins; const TreeNode* pMissingValueTreeNode = nullptr; if(TermBoostFlags_MissingLow & flags) { if(bMissing) { @@ -861,32 +863,25 @@ template class PartitionOneDimensionalBoo // Skip the missing bin in the pointer to pointer mapping since it will not be part of the continuous // region. pBin = IndexBin(pBin, cBytesPerBin); - --cBinsAdjusted; } } - const Bin** ppBinsEnd = - apBins + cBinsAdjusted; - do { *ppBin = pBin; pBin = IndexBin(pBin, cBytesPerBin); ++ppBin; - } while(ppBinsEnd != ppBin); + } while(pBinsEnd != pBin); if(bNominal) { std::sort(apBins, - ppBinsEnd, + ppBin, CompareBin( !(TermBoostFlags_DisableNewtonUpdate & flags), categoricalSmoothing)); } pRootTreeNode->BEFORE_SetBinFirst(apBins); - pRootTreeNode->BEFORE_SetBinLast(ppBinsEnd - 1); - ASSERT_BIN_OK(cBytesPerBin, *(ppBinsEnd - 1), pBoosterShell->GetDebugMainBinsEnd()); - - SumAllBins( - pBoosterShell, pBinsEnd, cSamplesTotal, weightTotal, pRootTreeNode->GetBin()); + pRootTreeNode->BEFORE_SetBinLast(ppBin - 1); + ASSERT_BIN_OK(cBytesPerBin, *(ppBin - 1), pBoosterShell->GetDebugMainBinsEnd()); EBM_ASSERT(!IsOverflowTreeNodeSize(bHessian, cScores)); const size_t cBytesPerTreeNode = GetTreeNodeSize(bHessian, cScores);