Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
6fa51478
Commit
6fa51478
authored
Jun 17, 2017
by
Guolin Ke
Browse files
reduce the cost of bagging.
parent
1c66bfcb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
17 deletions
+1
-17
src/treelearner/serial_tree_learner.cpp
src/treelearner/serial_tree_learner.cpp
+1
-17
No files found.
src/treelearner/serial_tree_learner.cpp
View file @
6fa51478
...
...
@@ -98,19 +98,11 @@ void SerialTreeLearner::Init(const Dataset* train_data, bool is_constant_hessian
void
SerialTreeLearner
::
ResetTrainingData
(
const
Dataset
*
train_data
)
{
train_data_
=
train_data
;
num_data_
=
train_data_
->
num_data
();
num_features_
=
train_data_
->
num_features
();
CHECK
(
num_features_
=
=
train_data_
->
num_features
()
)
;
// get ordered bin
train_data_
->
CreateOrderedBins
(
&
ordered_bins_
);
has_ordered_bin_
=
false
;
// check existing for ordered bin
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
ordered_bins_
.
size
());
++
i
)
{
if
(
ordered_bins_
[
i
]
!=
nullptr
)
{
has_ordered_bin_
=
true
;
break
;
}
}
// initialize splits for leaf
smaller_leaf_splits_
->
ResetNumData
(
num_data_
);
larger_leaf_splits_
->
ResetNumData
(
num_data_
);
...
...
@@ -118,8 +110,6 @@ void SerialTreeLearner::ResetTrainingData(const Dataset* train_data) {
// initialize data partition
data_partition_
->
ResetNumData
(
num_data_
);
is_feature_used_
.
resize
(
num_features_
);
// initialize ordered gradients and hessians
ordered_gradients_
.
resize
(
num_data_
);
ordered_hessians_
.
resize
(
num_data_
);
...
...
@@ -127,12 +117,6 @@ void SerialTreeLearner::ResetTrainingData(const Dataset* train_data) {
if
(
has_ordered_bin_
)
{
is_data_in_leaf_
.
resize
(
num_data_
);
std
::
fill
(
is_data_in_leaf_
.
begin
(),
is_data_in_leaf_
.
end
(),
static_cast
<
char
>
(
0
));
ordered_bin_indices_
.
clear
();
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
ordered_bins_
.
size
());
i
++
)
{
if
(
ordered_bins_
[
i
]
!=
nullptr
)
{
ordered_bin_indices_
.
push_back
(
i
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment