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
8869e1cb
Unverified
Commit
8869e1cb
authored
Sep 08, 2018
by
Guolin Ke
Committed by
GitHub
Sep 08, 2018
Browse files
fix lgb.cv with ndcg (#1646)
* fix ndcg group * fix ndcg
parent
a5ad3bdd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
python-package/lightgbm/basic.py
python-package/lightgbm/basic.py
+5
-0
No files found.
python-package/lightgbm/basic.py
View file @
8869e1cb
...
...
@@ -934,6 +934,9 @@ class Dataset(object):
# construct subset
used_indices
=
list_to_1d_numpy
(
self
.
used_indices
,
np
.
int32
,
name
=
'used_indices'
)
assert
used_indices
.
flags
.
c_contiguous
if
self
.
reference
.
group
is
not
None
:
group_info
=
np
.
array
(
self
.
reference
.
group
).
astype
(
int
)
_
,
self
.
group
=
np
.
unique
(
np
.
repeat
(
range_
(
len
(
group_info
)),
repeats
=
group_info
)[
self
.
used_indices
],
return_counts
=
True
)
self
.
handle
=
ctypes
.
c_void_p
()
params_str
=
param_dict_to_str
(
self
.
params
)
_safe_call
(
_LIB
.
LGBM_DatasetGetSubset
(
...
...
@@ -942,6 +945,8 @@ class Dataset(object):
ctypes
.
c_int
(
used_indices
.
shape
[
0
]),
c_str
(
params_str
),
ctypes
.
byref
(
self
.
handle
)))
if
self
.
group
is
not
None
:
self
.
set_group
(
self
.
group
)
if
self
.
get_label
()
is
None
:
raise
ValueError
(
"Label should not be None."
)
else
:
...
...
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