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
6e3e1ec2
Commit
6e3e1ec2
authored
Aug 07, 2017
by
Laurae
Committed by
Guolin Ke
Aug 18, 2017
Browse files
Unhandled errors must error properly (#797)
parent
08bdc86e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
48 deletions
+60
-48
R-package/R/lgb.Booster.R
R-package/R/lgb.Booster.R
+60
-48
No files found.
R-package/R/lgb.Booster.R
View file @
6e3e1ec2
...
...
@@ -32,6 +32,10 @@ Booster <- R6Class(
params
<-
append
(
params
,
list
(
...
))
params_str
<-
lgb.params2str
(
params
)
handle
<-
0.0
# Attempts to create a handle for the dataset
try
({
# Check if training dataset is not null
if
(
!
is.null
(
train_set
))
{
...
...
@@ -92,9 +96,16 @@ Booster <- R6Class(
stop
(
"lgb.Booster: Need at least either training dataset, model file, or model_str to create booster instance"
)
}
})
# Check whether the handle was created properly if it was not stopped earlier by a stop call
if
(
lgb.is.null.handle
(
handle
))
{
stop
(
"lgb.Booster: cannot create Booster handle"
)
}
else
{
# Create class
class
(
handle
)
<-
"lgb.Booster.handle"
private
$
handle
<-
handle
...
...
@@ -102,6 +113,7 @@ Booster <- R6Class(
private
$
num_class
<-
lgb.call
(
"LGBM_BoosterGetNumClasses_R"
,
ret
=
private
$
num_class
,
private
$
handle
)
}
},
...
...
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