Skip to content

Commit a8e1320

Browse files
committed
fix crashing bug for high bin missing values
1 parent 2a3376a commit a8e1320

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

shared/libebm/PartitionOneDimensionalBoosting.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -892,16 +892,13 @@ template<bool bHessian, size_t cCompilerScores> class PartitionOneDimensionalBoo
892892

893893
const TreeNode<bHessian, GetArrayScores(cCompilerScores)>* pMissingValueTreeNode = nullptr;
894894
if(TermBoostFlags_MissingLow & flags) {
895-
if(bMissing) {
896-
if(!bNominal) {
897-
pMissingBin = pBin;
898-
}
895+
if(bMissing && !bNominal) {
896+
pMissingBin = pBin;
899897
}
900898
} else if(TermBoostFlags_MissingHigh & flags) {
901-
if(bMissing) {
902-
if(!bNominal) {
903-
pMissingBin = pBin;
904-
}
899+
if(bMissing && !bNominal) {
900+
pMissingBin = pBin;
901+
// the concept of TermBoostFlags_MissingHigh does not exist for nominals
905902
pBin = IndexBin(pBin, cBytesPerBin);
906903
}
907904
} else {
@@ -920,7 +917,7 @@ template<bool bHessian, size_t cCompilerScores> class PartitionOneDimensionalBoo
920917
} while(pBinsEnd != pBin);
921918

922919
if(TermBoostFlags_MissingHigh & flags) {
923-
if(bMissing) {
920+
if(bMissing && !bNominal) {
924921
*ppBin = aBins;
925922
++ppBin;
926923
}
@@ -1113,8 +1110,10 @@ template<bool bHessian, size_t cCompilerScores> class PartitionOneDimensionalBoo
11131110
cSlices,
11141111
cBins);
11151112

1116-
EBM_ASSERT(!bMissing || 2 <= pBoosterShell->GetInnerTermUpdate()->GetCountSlices(iDimension));
1117-
EBM_ASSERT(!bMissing || *pBoosterShell->GetInnerTermUpdate()->GetSplitPointer(iDimension) == 1);
1113+
EBM_ASSERT(
1114+
error != Error_None || !bMissing || 2 <= pBoosterShell->GetInnerTermUpdate()->GetCountSlices(iDimension));
1115+
EBM_ASSERT(
1116+
error != Error_None || !bMissing || *pBoosterShell->GetInnerTermUpdate()->GetSplitPointer(iDimension) == 1);
11181117

11191118
return error;
11201119
}

0 commit comments

Comments
 (0)