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
9d431d12
Unverified
Commit
9d431d12
authored
Jul 21, 2020
by
Guolin Ke
Committed by
GitHub
Jul 20, 2020
Browse files
typo fix (#3239)
parent
50560573
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
src/treelearner/serial_tree_learner.cpp
src/treelearner/serial_tree_learner.cpp
+6
-6
No files found.
src/treelearner/serial_tree_learner.cpp
View file @
9d431d12
...
@@ -165,8 +165,8 @@ Tree* SerialTreeLearner::Train(const score_t* gradients, const score_t *hessians
...
@@ -165,8 +165,8 @@ Tree* SerialTreeLearner::Train(const score_t* gradients, const score_t *hessians
bool
track_branch_features
=
!
(
config_
->
interaction_constraints_vector
.
empty
());
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
=
std
::
unique_ptr
<
Tree
>
(
new
Tree
(
config_
->
num_leaves
,
track_branch_features
));
auto
tree_p
r
t
=
tree
.
get
();
auto
tree_pt
r
=
tree
.
get
();
constraints_
->
ShareTreePointer
(
tree_p
r
t
);
constraints_
->
ShareTreePointer
(
tree_pt
r
);
// root leaf
// root leaf
int
left_leaf
=
0
;
int
left_leaf
=
0
;
...
@@ -174,13 +174,13 @@ Tree* SerialTreeLearner::Train(const score_t* gradients, const score_t *hessians
...
@@ -174,13 +174,13 @@ Tree* SerialTreeLearner::Train(const score_t* gradients, const score_t *hessians
// only root leaf can be splitted on first time
// only root leaf can be splitted on first time
int
right_leaf
=
-
1
;
int
right_leaf
=
-
1
;
int
init_splits
=
ForceSplits
(
tree_p
r
t
,
&
left_leaf
,
&
right_leaf
,
&
cur_depth
);
int
init_splits
=
ForceSplits
(
tree_pt
r
,
&
left_leaf
,
&
right_leaf
,
&
cur_depth
);
for
(
int
split
=
init_splits
;
split
<
config_
->
num_leaves
-
1
;
++
split
)
{
for
(
int
split
=
init_splits
;
split
<
config_
->
num_leaves
-
1
;
++
split
)
{
// some initial works before finding best split
// some initial works before finding best split
if
(
BeforeFindBestSplit
(
tree_p
r
t
,
left_leaf
,
right_leaf
))
{
if
(
BeforeFindBestSplit
(
tree_pt
r
,
left_leaf
,
right_leaf
))
{
// find best threshold for every feature
// find best threshold for every feature
FindBestSplits
(
tree_p
r
t
);
FindBestSplits
(
tree_pt
r
);
}
}
// Get a leaf with max split gain
// Get a leaf with max split gain
int
best_leaf
=
static_cast
<
int
>
(
ArrayArgs
<
SplitInfo
>::
ArgMax
(
best_split_per_leaf_
));
int
best_leaf
=
static_cast
<
int
>
(
ArrayArgs
<
SplitInfo
>::
ArgMax
(
best_split_per_leaf_
));
...
@@ -192,7 +192,7 @@ Tree* SerialTreeLearner::Train(const score_t* gradients, const score_t *hessians
...
@@ -192,7 +192,7 @@ Tree* SerialTreeLearner::Train(const score_t* gradients, const score_t *hessians
break
;
break
;
}
}
// split tree with best leaf
// split tree with best leaf
Split
(
tree_p
r
t
,
best_leaf
,
&
left_leaf
,
&
right_leaf
);
Split
(
tree_pt
r
,
best_leaf
,
&
left_leaf
,
&
right_leaf
);
cur_depth
=
std
::
max
(
cur_depth
,
tree
->
leaf_depth
(
left_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
);
Log
::
Debug
(
"Trained a tree with leaves = %d and max_depth = %d"
,
tree
->
num_leaves
(),
cur_depth
);
...
...
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