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
b546836e
Commit
b546836e
authored
Jul 30, 2018
by
Nikita Titov
Committed by
Tsukasa OMOTO
Jul 31, 2018
Browse files
[python] simplified code with np.zeros (#1551)
parent
225eb5ed
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
python-package/lightgbm/basic.py
python-package/lightgbm/basic.py
+2
-3
No files found.
python-package/lightgbm/basic.py
View file @
b546836e
...
@@ -1961,7 +1961,7 @@ class Booster(object):
...
@@ -1961,7 +1961,7 @@ class Booster(object):
self
.
__get_eval_info
()
self
.
__get_eval_info
()
ret
=
[]
ret
=
[]
if
self
.
__num_inner_eval
>
0
:
if
self
.
__num_inner_eval
>
0
:
result
=
np
.
array
([
0.0
for
_
in
range_
(
self
.
__num_inner_eval
)]
,
dtype
=
np
.
float64
)
result
=
np
.
zeros
(
self
.
__num_inner_eval
,
dtype
=
np
.
float64
)
tmp_out_len
=
ctypes
.
c_int
(
0
)
tmp_out_len
=
ctypes
.
c_int
(
0
)
_safe_call
(
_LIB
.
LGBM_BoosterGetEval
(
_safe_call
(
_LIB
.
LGBM_BoosterGetEval
(
self
.
handle
,
self
.
handle
,
...
@@ -1997,8 +1997,7 @@ class Booster(object):
...
@@ -1997,8 +1997,7 @@ class Booster(object):
n_preds
=
self
.
train_set
.
num_data
()
*
self
.
__num_class
n_preds
=
self
.
train_set
.
num_data
()
*
self
.
__num_class
else
:
else
:
n_preds
=
self
.
valid_sets
[
data_idx
-
1
].
num_data
()
*
self
.
__num_class
n_preds
=
self
.
valid_sets
[
data_idx
-
1
].
num_data
()
*
self
.
__num_class
self
.
__inner_predict_buffer
[
data_idx
]
=
\
self
.
__inner_predict_buffer
[
data_idx
]
=
np
.
zeros
(
n_preds
,
dtype
=
np
.
float64
)
np
.
array
([
0.0
for
_
in
range_
(
n_preds
)],
dtype
=
np
.
float64
,
copy
=
False
)
# avoid to predict many time in one iteration
# avoid to predict many time in one iteration
if
not
self
.
__is_predicted_cur_iter
[
data_idx
]:
if
not
self
.
__is_predicted_cur_iter
[
data_idx
]:
tmp_out_len
=
ctypes
.
c_int64
(
0
)
tmp_out_len
=
ctypes
.
c_int64
(
0
)
...
...
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