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
fe9f292c
Commit
fe9f292c
authored
Sep 26, 2019
by
Nikita Titov
Committed by
Guolin Ke
Sep 26, 2019
Browse files
added new early_stopping param alias (#2431)
parent
be206a96
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
7 additions
and
6 deletions
+7
-6
R-package/R/lgb.cv.R
R-package/R/lgb.cv.R
+1
-1
R-package/R/lgb.train.R
R-package/R/lgb.train.R
+1
-1
docs/Parameters.rst
docs/Parameters.rst
+1
-1
include/LightGBM/config.h
include/LightGBM/config.h
+1
-1
python-package/lightgbm/engine.py
python-package/lightgbm/engine.py
+2
-2
src/io/config_auto.cpp
src/io/config_auto.cpp
+1
-0
No files found.
R-package/R/lgb.cv.R
View file @
fe9f292c
...
...
@@ -212,7 +212,7 @@ lgb.cv <- function(params = list(),
}
# Check for early stopping passed as parameter when adding early stopping callback
early_stop
<-
c
(
"early_stopping_round"
,
"early_stopping_rounds"
,
"early_stopping"
)
early_stop
<-
c
(
"early_stopping_round"
,
"early_stopping_rounds"
,
"early_stopping"
,
"n_iter_no_change"
)
if
(
any
(
names
(
params
)
%in%
early_stop
))
{
if
(
params
[[
which
(
names
(
params
)
%in%
early_stop
)[
1
]]]
>
0
)
{
callbacks
<-
add.cb
(
callbacks
,
cb.early.stop
(
params
[[
which
(
names
(
params
)
%in%
early_stop
)[
1
]]],
verbose
=
verbose
))
...
...
R-package/R/lgb.train.R
View file @
fe9f292c
...
...
@@ -195,7 +195,7 @@ lgb.train <- function(params = list(),
}
# Check for early stopping passed as parameter when adding early stopping callback
early_stop
<-
c
(
"early_stopping_round"
,
"early_stopping_rounds"
,
"early_stopping"
)
early_stop
<-
c
(
"early_stopping_round"
,
"early_stopping_rounds"
,
"early_stopping"
,
"n_iter_no_change"
)
if
(
any
(
names
(
params
)
%in%
early_stop
))
{
if
(
params
[[
which
(
names
(
params
)
%in%
early_stop
)[
1
]]]
>
0
)
{
callbacks
<-
add.cb
(
callbacks
,
cb.early.stop
(
params
[[
which
(
names
(
params
)
%in%
early_stop
)[
1
]]],
verbose
=
verbose
))
...
...
docs/Parameters.rst
View file @
fe9f292c
...
...
@@ -276,7 +276,7 @@ Learning Control Parameters
- random seed for ``feature_fraction``
- ``early_stopping_round`` :raw-html:`<a id="early_stopping_round" title="Permalink to this parameter" href="#early_stopping_round">🔗︎</a>`, default = ``0``, type = int, aliases: ``early_stopping_rounds``, ``early_stopping``
- ``early_stopping_round`` :raw-html:`<a id="early_stopping_round" title="Permalink to this parameter" href="#early_stopping_round">🔗︎</a>`, default = ``0``, type = int, aliases: ``early_stopping_rounds``, ``early_stopping``
, ``n_iter_no_change``
- will stop training if one metric of one validation data doesn't improve in last ``early_stopping_round`` rounds
...
...
include/LightGBM/config.h
View file @
fe9f292c
...
...
@@ -288,7 +288,7 @@ struct Config {
// desc = random seed for ``feature_fraction``
int
feature_fraction_seed
=
2
;
// alias = early_stopping_rounds, early_stopping
// alias = early_stopping_rounds, early_stopping
, n_iter_no_change
// desc = will stop training if one metric of one validation data doesn't improve in last ``early_stopping_round`` rounds
// desc = ``<= 0`` means disable
int
early_stopping_round
=
0
;
...
...
python-package/lightgbm/engine.py
View file @
fe9f292c
...
...
@@ -147,7 +147,7 @@ def train(params, train_set, num_boost_round=100,
num_boost_round
=
params
.
pop
(
alias
)
warnings
.
warn
(
"Found `{}` in params. Will use it instead of argument"
.
format
(
alias
))
break
for
alias
in
[
"early_stopping_round"
,
"early_stopping_rounds"
,
"early_stopping"
]:
for
alias
in
[
"early_stopping_round"
,
"early_stopping_rounds"
,
"early_stopping"
,
"n_iter_no_change"
]:
if
alias
in
params
:
early_stopping_rounds
=
params
.
pop
(
alias
)
warnings
.
warn
(
"Found `{}` in params. Will use it instead of argument"
.
format
(
alias
))
...
...
@@ -502,7 +502,7 @@ def cv(params, train_set, num_boost_round=100,
warnings
.
warn
(
"Found `{}` in params. Will use it instead of argument"
.
format
(
alias
))
num_boost_round
=
params
.
pop
(
alias
)
break
for
alias
in
[
"early_stopping_round"
,
"early_stopping_rounds"
,
"early_stopping"
]:
for
alias
in
[
"early_stopping_round"
,
"early_stopping_rounds"
,
"early_stopping"
,
"n_iter_no_change"
]:
if
alias
in
params
:
warnings
.
warn
(
"Found `{}` in params. Will use it instead of argument"
.
format
(
alias
))
early_stopping_rounds
=
params
.
pop
(
alias
)
...
...
src/io/config_auto.cpp
View file @
fe9f292c
...
...
@@ -72,6 +72,7 @@ std::unordered_map<std::string, std::string> Config::alias_table({
{
"colsample_bynode"
,
"feature_fraction_bynode"
},
{
"early_stopping_rounds"
,
"early_stopping_round"
},
{
"early_stopping"
,
"early_stopping_round"
},
{
"n_iter_no_change"
,
"early_stopping_round"
},
{
"max_tree_output"
,
"max_delta_step"
},
{
"max_leaf_output"
,
"max_delta_step"
},
{
"reg_alpha"
,
"lambda_l1"
},
...
...
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