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
a2ae8384
Commit
a2ae8384
authored
Jan 17, 2017
by
Laurae
Committed by
Guolin Ke
Jan 17, 2017
Browse files
More elegant, more obvious error for the enduser (#229)
parent
54a2356c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
R-package/R/lgb.Dataset.R
R-package/R/lgb.Dataset.R
+3
-3
No files found.
R-package/R/lgb.Dataset.R
View file @
a2ae8384
...
@@ -80,12 +80,12 @@ Dataset <- R6Class(
...
@@ -80,12 +80,12 @@ Dataset <- R6Class(
if
(
!
is.null
(
private
$
categorical_feature
))
{
if
(
!
is.null
(
private
$
categorical_feature
))
{
if
(
typeof
(
private
$
categorical_feature
)
==
"character"
)
{
if
(
typeof
(
private
$
categorical_feature
)
==
"character"
)
{
cate_indices
<-
as.list
(
match
(
private
$
categorical_feature
,
private
$
colnames
)
-
1
)
cate_indices
<-
as.list
(
match
(
private
$
categorical_feature
,
private
$
colnames
)
-
1
)
if
(
length
(
cate_indices
)
!=
length
(
private
$
categorical_feature
)
)
{
if
(
sum
(
is.na
(
cate_indices
)
)
>
0
)
{
stop
(
"lgb.self.get.handle:
cannot find feature name "
,
sQuote
(
private
$
categorical_feature
[
!
private
$
categorical_feature
%in%
private
$
colnam
es
]))
stop
(
"lgb.self.get.handle:
supplied an unknown feature in
categorical_feature
: "
,
sQuote
(
private
$
categorical_feature
[
is.na
(
cate_indic
es
)
]))
}
}
}
else
{
}
else
{
if
(
max
(
private
$
categorical_feature
)
>
length
(
private
$
colnames
))
{
if
(
max
(
private
$
categorical_feature
)
>
length
(
private
$
colnames
))
{
stop
(
"lgb.self.get.handle: supplied a too large value in categorical_feature"
)
stop
(
"lgb.self.get.handle: supplied a too large value in categorical_feature
: "
,
max
(
private
$
categorical_feature
),
" but only "
,
length
(
private
$
colnames
),
" features
"
)
}
}
cate_indices
<-
as.list
(
private
$
categorical_feature
-
1
)
cate_indices
<-
as.list
(
private
$
categorical_feature
-
1
)
}
}
...
...
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