Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve subfeature_bynode #3384

Merged
merged 3 commits into from
Sep 20, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/treelearner/serial_tree_learner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,9 +702,6 @@ void SerialTreeLearner::ComputeBestSplitForFeature(
FeatureHistogram* histogram_array_, int feature_index, int real_fidx,
bool is_feature_used, int num_data, const LeafSplits* leaf_splits,
SplitInfo* best_split) {
if (!is_feature_used) {
return;
}
SplitInfo new_split;
double parent_output;
if (leaf_splits->leaf_index() == 0) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@btrotta it seems the parent output is calculated repeatedly here for root node. I think this cost could be reduced.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll take a look

Expand All @@ -730,7 +727,7 @@ void SerialTreeLearner::ComputeBestSplitForFeature(
leaf_splits->leaf_index(), config_->monotone_penalty);
new_split.gain *= penalty;
}
if (new_split > *best_split) {
if (new_split > *best_split && is_feature_used) {
guolinke marked this conversation as resolved.
Show resolved Hide resolved
*best_split = new_split;
}
}
Expand Down