Skip to content

Commit

Permalink
code clean
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiyueXu77 committed Feb 27, 2024
1 parent e008818 commit 1fd1fb0
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/tree/hist/evaluate_splits.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ class HistEvaluator {
}
}
}

p_best->Update(best);
return left_sum;
}
Expand Down Expand Up @@ -385,8 +386,7 @@ class HistEvaluator {
auto n_bins = cut_ptrs.at(fidx + 1) - cut_ptrs[fidx];
if (common::UseOneHot(n_bins, param_->max_cat_to_onehot)) {
EnumerateOneHot(cut, histogram, fidx, nidx, evaluator, best);
}
else {
} else {
std::vector<size_t> sorted_idx(n_bins);
std::iota(sorted_idx.begin(), sorted_idx.end(), 0);
auto feat_hist = histogram.subspan(cut_ptrs[fidx], n_bins);
Expand All @@ -399,14 +399,8 @@ class HistEvaluator {
EnumeratePart<+1>(cut, sorted_idx, histogram, fidx, nidx, evaluator, best);
EnumeratePart<-1>(cut, sorted_idx, histogram, fidx, nidx, evaluator, best);
}
}
else {
} else {
auto grad_stats = EnumerateSplit<+1>(cut, histogram, fidx, nidx, evaluator, best);

// print the best split for each feature
//std::cout << "Current best split at feature " << fidx << " is: " << std::endl << *best << std::endl;


if (SplitContainsMissingValues(grad_stats, snode_[nidx])) {
EnumerateSplit<-1>(cut, histogram, fidx, nidx, evaluator, best);
}
Expand Down

0 comments on commit 1fd1fb0

Please sign in to comment.