MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / NeedFilter

Function NeedFilter

python-package/compile/src/io/bin.cpp:52–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50 }
51
52 bool NeedFilter(const std::vector<int>& cnt_in_bin, int total_cnt, int filter_cnt, BinType bin_type) {
53 if (bin_type == BinType::NumericalBin) {
54 int sum_left = 0;
55 for (size_t i = 0; i < cnt_in_bin.size() - 1; ++i) {
56 sum_left += cnt_in_bin[i];
57 if (sum_left >= filter_cnt && total_cnt - sum_left >= filter_cnt) {
58 return false;
59 }
60 }
61 } else {
62 if (cnt_in_bin.size() <= 2) {
63 for (size_t i = 0; i < cnt_in_bin.size() - 1; ++i) {
64 int sum_left = cnt_in_bin[i];
65 if (sum_left >= filter_cnt && total_cnt - sum_left >= filter_cnt) {
66 return false;
67 }
68 }
69 } else {
70 return false;
71 }
72 }
73 return true;
74 }
75
76 std::vector<double> GreedyFindBin(const double* distinct_values, const int* counts,
77 int num_distinct_values, int max_bin,

Callers 1

FindBinMethod · 0.70

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected