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

Method SplitCategorical

src/io/dense_bin.hpp:256–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

254 }
255
256 data_size_t SplitCategorical(
257 uint32_t min_bin, uint32_t max_bin, uint32_t default_bin,
258 const uint32_t* threshold, int num_threahold, data_size_t* data_indices, data_size_t num_data,
259 data_size_t* lte_indices, data_size_t* gt_indices) const override {
260 if (num_data <= 0) { return 0; }
261 data_size_t lte_count = 0;
262 data_size_t gt_count = 0;
263 data_size_t* default_indices = gt_indices;
264 data_size_t* default_count = &gt_count;
265 if (Common::FindInBitset(threshold, num_threahold, default_bin)) {
266 default_indices = lte_indices;
267 default_count = &lte_count;
268 }
269 for (data_size_t i = 0; i < num_data; ++i) {
270 const data_size_t idx = data_indices[i];
271 const uint32_t bin = data_[idx];
272 if (bin < min_bin || bin > max_bin) {
273 default_indices[(*default_count)++] = idx;
274 } else if (Common::FindInBitset(threshold, num_threahold, bin - min_bin)) {
275 lte_indices[lte_count++] = idx;
276 } else {
277 gt_indices[gt_count++] = idx;
278 }
279 }
280 return lte_count;
281 }
282
283 data_size_t num_data() const override { return num_data_; }
284

Callers

nothing calls this directly

Calls 1

FindInBitsetFunction · 0.50

Tested by

no test coverage detected