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

Method Boosting

src/boosting/rf.hpp:82–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80 }
81
82 void Boosting() override {
83 if (objective_function_ == nullptr) {
84 Log::Fatal("RF mode do not support custom objective function, please use built-in objectives.");
85 }
86 init_scores_.resize(num_tree_per_iteration_, 0.0);
87 for (int cur_tree_id = 0; cur_tree_id < num_tree_per_iteration_; ++cur_tree_id) {
88 init_scores_[cur_tree_id] = BoostFromAverage(cur_tree_id, false);
89 }
90 size_t total_size = static_cast<size_t>(num_data_) * num_tree_per_iteration_;
91 std::vector<double> tmp_scores(total_size, 0.0f);
92 #pragma omp parallel for schedule(static)
93 for (int j = 0; j < num_tree_per_iteration_; ++j) {
94 size_t offset = static_cast<size_t>(j)* num_data_;
95 for (data_size_t i = 0; i < num_data_; ++i) {
96 tmp_scores[offset + i] = init_scores_[j];
97 }
98 }
99 objective_function_->
100 GetGradients(tmp_scores.data(), gradients_.data(), hessians_.data());
101 }
102
103 bool TrainOneIter(const score_t* gradients, const score_t* hessians) override {
104 // bagging logic

Callers

nothing calls this directly

Calls 3

dataMethod · 0.80
resizeMethod · 0.45
GetGradientsMethod · 0.45

Tested by

no test coverage detected