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
21575cb2
Commit
21575cb2
authored
Aug 27, 2018
by
James Lamb
Committed by
Laurae
Aug 27, 2018
Browse files
updated R dependencies (#1619)
parent
b2240721
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
354 additions
and
341 deletions
+354
-341
R-package/DESCRIPTION
R-package/DESCRIPTION
+10
-10
R-package/NAMESPACE
R-package/NAMESPACE
+6
-0
R-package/R/lgb.Dataset.R
R-package/R/lgb.Dataset.R
+252
-250
R-package/R/lgb.Predictor.R
R-package/R/lgb.Predictor.R
+51
-49
R-package/R/lgb.model.dt.tree.R
R-package/R/lgb.model.dt.tree.R
+35
-32
No files found.
R-package/DESCRIPTION
View file @
21575cb2
...
...
@@ -23,23 +23,23 @@ URL: https://github.com/Microsoft/LightGBM
BugReports: https://github.com/Microsoft/LightGBM/issues
VignetteBuilder: knitr
Suggests:
Ckmeans.1d.dp (>= 3.3.1),
DiagrammeR (>= 0.8.1),
ggplot2 (>= 1.0.1),
igraph (>= 1.0.1),
knitr,
rmarkdown,
ggplot2 (>= 1.0.1),
DiagrammeR (>= 0.8.1),
Ckmeans.1d.dp (>= 3.3.1),
vcd (>= 1.3),
stringi (>= 0.5.2),
testthat,
igraph (>= 1.0.1),
stringi (>= 0.5.2)
vcd (>= 1.3)
Depends:
R (>= 3.0),
R6 (>= 2.0)
Imports:
graphics,
methods,
Matrix (>= 1.1-0),
data.table (>= 1.9.6),
graphics,
jsonlite (>= 1.0),
magrittr (>= 1.5),
jsonlite (>= 1.0)
Matrix (>= 1.1-0),
methods
RoxygenNote: 6.0.1
R-package/NAMESPACE
View file @
21575cb2
...
...
@@ -38,9 +38,15 @@ export(slice)
import(methods)
importFrom(R6,R6Class)
importFrom(data.table,":=")
importFrom(data.table,data.table)
importFrom(data.table,rbindlist)
importFrom(data.table,set)
importFrom(graphics,barplot)
importFrom(graphics,par)
importFrom(jsonlite,fromJSON)
importFrom(magrittr,"%>%")
importFrom(magrittr,"%T>%")
importFrom(magrittr,extract)
importFrom(magrittr,inset)
importFrom(methods,is)
useDynLib(lib_lightgbm)
R-package/R/lgb.Dataset.R
View file @
21575cb2
#' @importFrom methods is
Dataset
<-
R6Class
(
classname
=
"lgb.Dataset"
,
cloneable
=
FALSE
,
...
...
@@ -120,7 +122,7 @@ Dataset <- R6Class(
# Get feature names
cnames
<-
NULL
if
(
is.matrix
(
private
$
raw_data
)
||
is
(
private
$
raw_data
,
"dgCMatrix"
))
{
if
(
is.matrix
(
private
$
raw_data
)
||
methods
::
is
(
private
$
raw_data
,
"dgCMatrix"
))
{
cnames
<-
colnames
(
private
$
raw_data
)
}
...
...
@@ -200,7 +202,7 @@ Dataset <- R6Class(
params_str
,
ref_handle
)
}
else
if
(
is
(
private
$
raw_data
,
"dgCMatrix"
))
{
}
else
if
(
methods
::
is
(
private
$
raw_data
,
"dgCMatrix"
))
{
if
(
length
(
private
$
raw_data
@
p
)
>
2147483647
)
{
stop
(
"Cannot support large CSC matrix"
)
}
...
...
@@ -304,7 +306,7 @@ Dataset <- R6Class(
c
(
lgb.call
(
"LGBM_DatasetGetNumData_R"
,
ret
=
num_row
,
private
$
handle
),
lgb.call
(
"LGBM_DatasetGetNumFeature_R"
,
ret
=
num_col
,
private
$
handle
))
}
else
if
(
is.matrix
(
private
$
raw_data
)
||
is
(
private
$
raw_data
,
"dgCMatrix"
))
{
}
else
if
(
is.matrix
(
private
$
raw_data
)
||
methods
::
is
(
private
$
raw_data
,
"dgCMatrix"
))
{
# Check if dgCMatrix (sparse matrix column compressed)
dim
(
private
$
raw_data
)
...
...
@@ -329,7 +331,7 @@ Dataset <- R6Class(
private
$
colnames
<-
as.character
(
base
::
strsplit
(
cnames
,
"\t"
)[[
1
]])
private
$
colnames
}
else
if
(
is.matrix
(
private
$
raw_data
)
||
is
(
private
$
raw_data
,
"dgCMatrix"
))
{
}
else
if
(
is.matrix
(
private
$
raw_data
)
||
methods
::
is
(
private
$
raw_data
,
"dgCMatrix"
))
{
# Check if dgCMatrix (sparse matrix column compressed)
colnames
(
private
$
raw_data
)
...
...
R-package/R/lgb.Predictor.R
View file @
21575cb2
#' @importFrom methods is
Predictor
<-
R6Class
(
classname
=
"lgb.Predictor"
,
cloneable
=
FALSE
,
...
...
@@ -31,7 +33,7 @@ Predictor <- R6Class(
handle
<-
lgb.call
(
"LGBM_BoosterCreateFromModelfile_R"
,
ret
=
handle
,
lgb.c_str
(
modelfile
))
private
$
need_free_handle
<-
TRUE
}
else
if
(
is
(
modelfile
,
"lgb.Booster.handle"
))
{
}
else
if
(
methods
::
is
(
modelfile
,
"lgb.Booster.handle"
))
{
# Check if model file is a booster handle already
handle
<-
modelfile
...
...
@@ -131,7 +133,7 @@ Predictor <- R6Class(
as.integer
(
num_iteration
),
private
$
params
)
}
else
if
(
is
(
data
,
"dgCMatrix"
))
{
}
else
if
(
methods
::
is
(
data
,
"dgCMatrix"
))
{
if
(
length
(
data
@
p
)
>
2147483647
)
{
stop
(
"Cannot support large CSC matrix"
)
}
...
...
R-package/R/lgb.model.dt.tree.R
View file @
21575cb2
...
...
@@ -47,7 +47,8 @@
#' }
#'
#' @importFrom magrittr %>%
#' @importFrom data.table :=
#' @importFrom data.table := data.table
#' @importFrom jsonlite fromJSON
#' @export
lgb.model.dt.tree
<-
function
(
model
,
num_iteration
=
NULL
)
{
...
...
@@ -77,6 +78,7 @@ lgb.model.dt.tree <- function(model, num_iteration = NULL) {
}
#' @importFrom data.table data.table rbindlist
single.tree.parse
<-
function
(
lgb_tree
)
{
# Traverse tree function
...
...
@@ -161,6 +163,7 @@ single.tree.parse <- function(lgb_tree) {
}
#' @importFrom magrittr %>% extract inset
Lookup
<-
function
(
key
,
key_lookup
,
value_lookup
,
missing
=
NA
)
{
# Match key by looked up key
...
...
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