MCPcopy Create free account
hub / github.com/catboost/catboost / LeftBorder

Method LeftBorder

library/cpp/grid_creator/binarization.cpp:1357–1371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1355 }
1356
1357 float LeftBorder(const TMaybe<TVector<float>>& initialBorders) const {
1358 Y_ASSERT(BinStart < BinEnd);
1359 if (IsFirst()) {
1360 return *FeaturesStart;
1361 }
1362 if (initialBorders) {
1363 const auto possibleBorder = UpperBound(initialBorders->begin(), initialBorders->end(), (*(FeaturesStart + BinStart - 1)));
1364 if (possibleBorder != initialBorders->end() && (*possibleBorder) <= (*(FeaturesStart + BinStart))) {
1365 return (*possibleBorder);
1366 }
1367 }
1368 float borderValue = 0.5f * (*(FeaturesStart + BinStart - 1));
1369 borderValue += 0.5f * (*(FeaturesStart + BinStart));
1370 return borderValue;
1371 }
1372
1373 bool IsFirst() const {
1374 return BinStart == 0;

Callers 1

GreedySplitFunction · 0.80

Calls 3

UpperBoundFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected