Skip to content

Commit

Permalink
typo fix (#3239)
Browse files Browse the repository at this point in the history
  • Loading branch information
guolinke authored Jul 20, 2020
1 parent 5056057 commit 9d431d1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/treelearner/serial_tree_learner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,22 +165,22 @@ Tree* SerialTreeLearner::Train(const score_t* gradients, const score_t *hessians

bool track_branch_features = !(config_->interaction_constraints_vector.empty());
auto tree = std::unique_ptr<Tree>(new Tree(config_->num_leaves, track_branch_features));
auto tree_prt = tree.get();
constraints_->ShareTreePointer(tree_prt);
auto tree_ptr = tree.get();
constraints_->ShareTreePointer(tree_ptr);

// root leaf
int left_leaf = 0;
int cur_depth = 1;
// only root leaf can be splitted on first time
int right_leaf = -1;

int init_splits = ForceSplits(tree_prt, &left_leaf, &right_leaf, &cur_depth);
int init_splits = ForceSplits(tree_ptr, &left_leaf, &right_leaf, &cur_depth);

for (int split = init_splits; split < config_->num_leaves - 1; ++split) {
// some initial works before finding best split
if (BeforeFindBestSplit(tree_prt, left_leaf, right_leaf)) {
if (BeforeFindBestSplit(tree_ptr, left_leaf, right_leaf)) {
// find best threshold for every feature
FindBestSplits(tree_prt);
FindBestSplits(tree_ptr);
}
// Get a leaf with max split gain
int best_leaf = static_cast<int>(ArrayArgs<SplitInfo>::ArgMax(best_split_per_leaf_));
Expand All @@ -192,7 +192,7 @@ Tree* SerialTreeLearner::Train(const score_t* gradients, const score_t *hessians
break;
}
// split tree with best leaf
Split(tree_prt, best_leaf, &left_leaf, &right_leaf);
Split(tree_ptr, best_leaf, &left_leaf, &right_leaf);
cur_depth = std::max(cur_depth, tree->leaf_depth(left_leaf));
}
Log::Debug("Trained a tree with leaves = %d and max_depth = %d", tree->num_leaves(), cur_depth);
Expand Down

0 comments on commit 9d431d1

Please sign in to comment.