Skip to content

Commit

Permalink
Fix updates in random forest model using GOSS data sample strategy (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mjmckp committed Sep 5, 2023
1 parent 5ea0057 commit 8203306
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/boosting/rf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ class RF : public GBDT {
const data_size_t bag_data_cnt = data_sample_strategy_->bag_data_cnt();
const std::vector<data_size_t, Common::AlignmentAllocator<data_size_t, kAlignedSize>>& bag_data_indices = data_sample_strategy_->bag_data_indices();

// GOSSStrategy->Bagging may modify value of bag_data_cnt_
if (is_use_subset && bag_data_cnt < num_data_) {
tmp_grad_.resize(num_data_);
tmp_hess_.resize(num_data_);
}

CHECK_EQ(gradients, nullptr);
CHECK_EQ(hessians, nullptr);

Expand Down

0 comments on commit 8203306

Please sign in to comment.