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

Function GreedySplit

library/cpp/grid_creator/binarization.cpp:1500–1520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1498
1499 template<class TBinType>
1500 THashSet<float> GreedySplit(const TBinType& initialBin, const TMaybe<TVector<float>>& initialBorders, int maxBordersCount) {
1501 std::priority_queue<TBinType> splits;
1502 splits.push(initialBin);
1503
1504 while (splits.size() <= (ui32) maxBordersCount && splits.top().CanSplit()) {
1505 auto top = splits.top();
1506 splits.pop();
1507 auto left = top.Split();
1508 splits.push(left);
1509 splits.push(top);
1510 }
1511
1512 THashSet<float> borders;
1513 borders.reserve(splits.size() - 1);
1514 while (!splits.empty()) {
1515 if (!splits.top().IsFirst())
1516 borders.insert(splits.top().LeftBorder(initialBorders));
1517 splits.pop();
1518 }
1519 return borders;
1520 }
1521
1522 template<EPenaltyType penaltyType, class TWeightIteratorType>
1523 THashSet<float> BestWeightedSplitImpl(

Callers 2

BestWeightedSplitImplFunction · 0.85
BestSplitMethod · 0.85

Calls 10

CanSplitMethod · 0.80
IsFirstMethod · 0.80
LeftBorderMethod · 0.80
pushMethod · 0.45
sizeMethod · 0.45
popMethod · 0.45
SplitMethod · 0.45
reserveMethod · 0.45
emptyMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected