"...git@developer.sourcefind.cn:tianlh/lightgbm-dcu.git" did not exist on "416ecd5a8de1b2b9225ded3c919cb0d40ec0d9bd"
Unverified Commit 1fddabb5 authored by Guolin Ke's avatar Guolin Ke Committed by GitHub
Browse files

improve subfeature_bynode (#3384)

* Update serial_tree_learner.cpp

* Update src/treelearner/serial_tree_learner.cpp

* Update src/treelearner/serial_tree_learner.cpp
parent a3b9dae7
...@@ -702,9 +702,6 @@ void SerialTreeLearner::ComputeBestSplitForFeature( ...@@ -702,9 +702,6 @@ void SerialTreeLearner::ComputeBestSplitForFeature(
FeatureHistogram* histogram_array_, int feature_index, int real_fidx, FeatureHistogram* histogram_array_, int feature_index, int real_fidx,
bool is_feature_used, int num_data, const LeafSplits* leaf_splits, bool is_feature_used, int num_data, const LeafSplits* leaf_splits,
SplitInfo* best_split) { SplitInfo* best_split) {
if (!is_feature_used) {
return;
}
SplitInfo new_split; SplitInfo new_split;
double parent_output; double parent_output;
if (leaf_splits->leaf_index() == 0) { if (leaf_splits->leaf_index() == 0) {
...@@ -730,7 +727,9 @@ void SerialTreeLearner::ComputeBestSplitForFeature( ...@@ -730,7 +727,9 @@ void SerialTreeLearner::ComputeBestSplitForFeature(
leaf_splits->leaf_index(), config_->monotone_penalty); leaf_splits->leaf_index(), config_->monotone_penalty);
new_split.gain *= penalty; new_split.gain *= penalty;
} }
if (new_split > *best_split) { // it is needed to filter the features after the above code.
// Otherwise, the `is_splittable` in `FeatureHistogram` will be wrong, and cause some features being accidentally filtered in the later nodes.
if (new_split > *best_split && is_feature_used) {
*best_split = new_split; *best_split = new_split;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment