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
99cc4f2f
Unverified
Commit
99cc4f2f
authored
Aug 27, 2021
by
Nikita Titov
Committed by
GitHub
Aug 27, 2021
Browse files
[python] Use double type for `init_score` array when set by predictor (#4510)
parent
c6199311
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
python-package/lightgbm/basic.py
python-package/lightgbm/basic.py
+3
-3
No files found.
python-package/lightgbm/basic.py
View file @
99cc4f2f
...
...
@@ -1394,7 +1394,7 @@ class Dataset:
if
used_indices
is
not
None
:
assert
not
self
.
need_slice
if
isinstance
(
data
,
(
str
,
Path
)):
sub_init_score
=
np
.
empty
(
num_data
*
predictor
.
num_class
,
dtype
=
np
.
float
32
)
sub_init_score
=
np
.
empty
(
num_data
*
predictor
.
num_class
,
dtype
=
np
.
float
64
)
assert
num_data
==
len
(
used_indices
)
for
i
in
range
(
len
(
used_indices
)):
for
j
in
range
(
predictor
.
num_class
):
...
...
@@ -1402,13 +1402,13 @@ class Dataset:
init_score
=
sub_init_score
if
predictor
.
num_class
>
1
:
# need to regroup init_score
new_init_score
=
np
.
empty
(
init_score
.
size
,
dtype
=
np
.
float
32
)
new_init_score
=
np
.
empty
(
init_score
.
size
,
dtype
=
np
.
float
64
)
for
i
in
range
(
num_data
):
for
j
in
range
(
predictor
.
num_class
):
new_init_score
[
j
*
num_data
+
i
]
=
init_score
[
i
*
predictor
.
num_class
+
j
]
init_score
=
new_init_score
elif
self
.
init_score
is
not
None
:
init_score
=
np
.
zeros
(
self
.
init_score
.
shape
,
dtype
=
np
.
float
32
)
init_score
=
np
.
zeros
(
self
.
init_score
.
shape
,
dtype
=
np
.
float
64
)
else
:
return
self
self
.
set_init_score
(
init_score
)
...
...
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