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

Method SplitCategorical

src/io/dense_nbits_bin.hpp:279–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277 }
278
279 data_size_t SplitCategorical(
280 uint32_t min_bin, uint32_t max_bin, uint32_t default_bin,
281 const uint32_t* threshold, int num_threahold, data_size_t* data_indices, data_size_t num_data,
282 data_size_t* lte_indices, data_size_t* gt_indices) const override {
283 if (num_data <= 0) { return 0; }
284 data_size_t lte_count = 0;
285 data_size_t gt_count = 0;
286 data_size_t* default_indices = gt_indices;
287 data_size_t* default_count = &gt_count;
288 if (Common::FindInBitset(threshold, num_threahold, default_bin)) {
289 default_indices = lte_indices;
290 default_count = &lte_count;
291 }
292 for (data_size_t i = 0; i < num_data; ++i) {
293 const data_size_t idx = data_indices[i];
294 const uint32_t bin = (data_[idx >> 1] >> ((idx & 1) << 2)) & 0xf;
295 if (bin < min_bin || bin > max_bin) {
296 default_indices[(*default_count)++] = idx;
297 } else if (Common::FindInBitset(threshold, num_threahold, bin - min_bin)) {
298 lte_indices[lte_count++] = idx;
299 } else {
300 gt_indices[gt_count++] = idx;
301 }
302 }
303 return lte_count;
304 }
305
306 data_size_t num_data() const override { return num_data_; }
307

Callers

nothing calls this directly

Calls 1

FindInBitsetFunction · 0.50

Tested by

no test coverage detected