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
9ee10754
Commit
9ee10754
authored
Dec 22, 2017
by
Guolin Ke
Browse files
fix the error message for get_field
parent
b30beb99
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
R-package/R/lgb.Dataset.R
R-package/R/lgb.Dataset.R
+4
-2
python-package/lightgbm/basic.py
python-package/lightgbm/basic.py
+5
-5
No files found.
R-package/R/lgb.Dataset.R
View file @
9ee10754
...
@@ -379,8 +379,10 @@ Dataset <- R6Class(
...
@@ -379,8 +379,10 @@ Dataset <- R6Class(
}
}
# Check for info name and handle
# Check for info name and handle
if
(
is.null
(
private
$
info
[[
name
]])
&&
!
lgb.is.null.handle
(
private
$
handle
))
{
if
(
is.null
(
private
$
info
[[
name
]]))
{
if
(
lgb.is.null.handle
(
private
$
handle
)){
stop
(
"Cannot perform getinfo before construct Dataset."
)
}
# Get field size of info
# Get field size of info
info_len
<-
0L
info_len
<-
0L
info_len
<-
lgb.call
(
"LGBM_DatasetGetFieldSize_R"
,
info_len
<-
lgb.call
(
"LGBM_DatasetGetFieldSize_R"
,
...
...
python-package/lightgbm/basic.py
View file @
9ee10754
...
@@ -986,7 +986,7 @@ class Dataset(object):
...
@@ -986,7 +986,7 @@ class Dataset(object):
A numpy array with information from the Dataset.
A numpy array with information from the Dataset.
"""
"""
if
self
.
handle
is
None
:
if
self
.
handle
is
None
:
raise
Exception
(
"Cannot get %s before construct
d
ataset"
%
field_name
)
raise
Exception
(
"Cannot get %s before construct
D
ataset"
%
field_name
)
tmp_out_len
=
ctypes
.
c_int
()
tmp_out_len
=
ctypes
.
c_int
()
out_type
=
ctypes
.
c_int
()
out_type
=
ctypes
.
c_int
()
ret
=
ctypes
.
POINTER
(
ctypes
.
c_void_p
)()
ret
=
ctypes
.
POINTER
(
ctypes
.
c_void_p
)()
...
@@ -1144,7 +1144,7 @@ class Dataset(object):
...
@@ -1144,7 +1144,7 @@ class Dataset(object):
label : numpy array
label : numpy array
The label information from the Dataset.
The label information from the Dataset.
"""
"""
if
self
.
label
is
None
and
self
.
handle
is
not
None
:
if
self
.
label
is
None
:
self
.
label
=
self
.
get_field
(
'label'
)
self
.
label
=
self
.
get_field
(
'label'
)
return
self
.
label
return
self
.
label
...
@@ -1156,7 +1156,7 @@ class Dataset(object):
...
@@ -1156,7 +1156,7 @@ class Dataset(object):
weight : numpy array
weight : numpy array
Weight for each data point from the Dataset.
Weight for each data point from the Dataset.
"""
"""
if
self
.
weight
is
None
and
self
.
handle
is
not
None
:
if
self
.
weight
is
None
:
self
.
weight
=
self
.
get_field
(
'weight'
)
self
.
weight
=
self
.
get_field
(
'weight'
)
return
self
.
weight
return
self
.
weight
...
@@ -1168,7 +1168,7 @@ class Dataset(object):
...
@@ -1168,7 +1168,7 @@ class Dataset(object):
init_score : numpy array
init_score : numpy array
Init score of Booster.
Init score of Booster.
"""
"""
if
self
.
init_score
is
None
and
self
.
handle
is
not
None
:
if
self
.
init_score
is
None
:
self
.
init_score
=
self
.
get_field
(
'init_score'
)
self
.
init_score
=
self
.
get_field
(
'init_score'
)
return
self
.
init_score
return
self
.
init_score
...
@@ -1180,7 +1180,7 @@ class Dataset(object):
...
@@ -1180,7 +1180,7 @@ class Dataset(object):
group : numpy array
group : numpy array
Group size of each group.
Group size of each group.
"""
"""
if
self
.
group
is
None
and
self
.
handle
is
not
None
:
if
self
.
group
is
None
:
self
.
group
=
self
.
get_field
(
'group'
)
self
.
group
=
self
.
get_field
(
'group'
)
if
self
.
group
is
not
None
:
if
self
.
group
is
not
None
:
# group data from LightGBM is boundaries data, need to convert to group size
# group data from LightGBM is boundaries data, need to convert to group size
...
...
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