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
4df7b21d
Commit
4df7b21d
authored
Jul 31, 2018
by
Nikita Titov
Committed by
Qiwei Ye
Jul 31, 2018
Browse files
updated params aliases in Python (#1549)
parent
61191ed2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
15 deletions
+19
-15
python-package/lightgbm/basic.py
python-package/lightgbm/basic.py
+16
-14
python-package/lightgbm/callback.py
python-package/lightgbm/callback.py
+3
-1
No files found.
python-package/lightgbm/basic.py
View file @
4df7b21d
...
...
@@ -1370,8 +1370,9 @@ class Booster(object):
self
.
__get_eval_info
()
self
.
pandas_categorical
=
train_set
.
pandas_categorical
# set network if necessary
if
"machines"
in
params
:
machines
=
params
[
"machines"
]
for
alias
in
[
"machines"
,
"workers"
,
"nodes"
]:
if
alias
in
params
:
machines
=
params
[
alias
]
if
isinstance
(
machines
,
string_type
):
num_machines
=
len
(
machines
.
split
(
','
))
elif
isinstance
(
machines
,
(
list
,
set
)):
...
...
@@ -1383,6 +1384,7 @@ class Booster(object):
local_listen_port
=
params
.
get
(
"local_listen_port"
,
12400
),
listen_time_out
=
params
.
get
(
"listen_time_out"
,
120
),
num_machines
=
params
.
get
(
"num_machines"
,
num_machines
))
break
elif
model_file
is
not
None
:
# Prediction task
out_num_iterations
=
ctypes
.
c_int
(
0
)
...
...
@@ -1521,7 +1523,7 @@ class Booster(object):
params : dict
New parameters for Booster.
"""
if
'
metric
'
in
params
:
if
any
(
metric
_alias
in
params
for
metric_alias
in
(
'metric'
,
'metrics'
,
'metric_types'
))
:
self
.
__need_reload_eval_info
=
True
params_str
=
param_dict_to_str
(
params
)
if
params_str
:
...
...
python-package/lightgbm/callback.py
View file @
4df7b21d
...
...
@@ -127,7 +127,9 @@ def reset_parameter(**kwargs):
"""internal function"""
new_parameters
=
{}
for
key
,
value
in
kwargs
.
items
():
if
key
in
[
'num_class'
,
'boosting_type'
,
'metric'
]:
if
key
in
[
'num_class'
,
'num_classes'
,
'boosting'
,
'boost'
,
'boosting_type'
,
'metric'
,
'metrics'
,
'metric_types'
]:
raise
RuntimeError
(
"cannot reset {} during training"
.
format
(
repr
(
key
)))
if
isinstance
(
value
,
list
):
if
len
(
value
)
!=
env
.
end_iteration
-
env
.
begin_iteration
:
...
...
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