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

Method Init

src/treelearner/data_partition.hpp:59–74  ·  view source on GitHub ↗

! * \brief Init, will put all data on the root(leaf_idx = 0) */

Source from the content-addressed store, hash-verified

57 * \brief Init, will put all data on the root(leaf_idx = 0)
58 */
59 void Init() {
60 std::fill(leaf_begin_.begin(), leaf_begin_.end(), 0);
61 std::fill(leaf_count_.begin(), leaf_count_.end(), 0);
62 if (used_data_indices_ == nullptr) {
63 // if using all data
64 leaf_count_[0] = num_data_;
65 #pragma omp parallel for schedule(static)
66 for (data_size_t i = 0; i < num_data_; ++i) {
67 indices_[i] = i;
68 }
69 } else {
70 // if bagging
71 leaf_count_[0] = used_data_count_;
72 std::memcpy(indices_.data(), used_data_indices_, used_data_count_ * sizeof(data_size_t));
73 }
74 }
75
76 void ResetByLeafPred(const std::vector<int>& leaf_pred, int num_leaves) {
77 ResetLeaves(num_leaves);

Callers

nothing calls this directly

Calls 4

dataMethod · 0.80
fillFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected