Commit 21575cb2 authored by James Lamb's avatar James Lamb Committed by Laurae
Browse files

updated R dependencies (#1619)

parent b2240721
...@@ -23,23 +23,23 @@ URL: https://github.com/Microsoft/LightGBM ...@@ -23,23 +23,23 @@ URL: https://github.com/Microsoft/LightGBM
BugReports: https://github.com/Microsoft/LightGBM/issues BugReports: https://github.com/Microsoft/LightGBM/issues
VignetteBuilder: knitr VignetteBuilder: knitr
Suggests: Suggests:
Ckmeans.1d.dp (>= 3.3.1),
DiagrammeR (>= 0.8.1),
ggplot2 (>= 1.0.1),
igraph (>= 1.0.1),
knitr, knitr,
rmarkdown, rmarkdown,
ggplot2 (>= 1.0.1), stringi (>= 0.5.2),
DiagrammeR (>= 0.8.1),
Ckmeans.1d.dp (>= 3.3.1),
vcd (>= 1.3),
testthat, testthat,
igraph (>= 1.0.1), vcd (>= 1.3)
stringi (>= 0.5.2)
Depends: Depends:
R (>= 3.0), R (>= 3.0),
R6 (>= 2.0) R6 (>= 2.0)
Imports: Imports:
graphics,
methods,
Matrix (>= 1.1-0),
data.table (>= 1.9.6), data.table (>= 1.9.6),
graphics,
jsonlite (>= 1.0),
magrittr (>= 1.5), magrittr (>= 1.5),
jsonlite (>= 1.0) Matrix (>= 1.1-0),
methods
RoxygenNote: 6.0.1 RoxygenNote: 6.0.1
...@@ -38,9 +38,15 @@ export(slice) ...@@ -38,9 +38,15 @@ export(slice)
import(methods) import(methods)
importFrom(R6,R6Class) importFrom(R6,R6Class)
importFrom(data.table,":=") importFrom(data.table,":=")
importFrom(data.table,data.table)
importFrom(data.table,rbindlist)
importFrom(data.table,set) importFrom(data.table,set)
importFrom(graphics,barplot) importFrom(graphics,barplot)
importFrom(graphics,par) importFrom(graphics,par)
importFrom(jsonlite,fromJSON)
importFrom(magrittr,"%>%") importFrom(magrittr,"%>%")
importFrom(magrittr,"%T>%") importFrom(magrittr,"%T>%")
importFrom(magrittr,extract)
importFrom(magrittr,inset)
importFrom(methods,is)
useDynLib(lib_lightgbm) useDynLib(lib_lightgbm)
#' @importFrom methods is
Dataset <- R6Class( Dataset <- R6Class(
classname = "lgb.Dataset", classname = "lgb.Dataset",
cloneable = FALSE, cloneable = FALSE,
...@@ -120,7 +122,7 @@ Dataset <- R6Class( ...@@ -120,7 +122,7 @@ Dataset <- R6Class(
# Get feature names # Get feature names
cnames <- NULL 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) cnames <- colnames(private$raw_data)
} }
...@@ -200,7 +202,7 @@ Dataset <- R6Class( ...@@ -200,7 +202,7 @@ Dataset <- R6Class(
params_str, params_str,
ref_handle) ref_handle)
} else if (is(private$raw_data, "dgCMatrix")) { } else if (methods::is(private$raw_data, "dgCMatrix")) {
if (length(private$raw_data@p) > 2147483647) { if (length(private$raw_data@p) > 2147483647) {
stop("Cannot support large CSC matrix") stop("Cannot support large CSC matrix")
} }
...@@ -304,7 +306,7 @@ Dataset <- R6Class( ...@@ -304,7 +306,7 @@ Dataset <- R6Class(
c(lgb.call("LGBM_DatasetGetNumData_R", ret = num_row, private$handle), c(lgb.call("LGBM_DatasetGetNumData_R", ret = num_row, private$handle),
lgb.call("LGBM_DatasetGetNumFeature_R", ret = num_col, 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) # Check if dgCMatrix (sparse matrix column compressed)
dim(private$raw_data) dim(private$raw_data)
...@@ -329,7 +331,7 @@ Dataset <- R6Class( ...@@ -329,7 +331,7 @@ Dataset <- R6Class(
private$colnames <- as.character(base::strsplit(cnames, "\t")[[1]]) private$colnames <- as.character(base::strsplit(cnames, "\t")[[1]])
private$colnames 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) # Check if dgCMatrix (sparse matrix column compressed)
colnames(private$raw_data) colnames(private$raw_data)
......
#' @importFrom methods is
Predictor <- R6Class( Predictor <- R6Class(
classname = "lgb.Predictor", classname = "lgb.Predictor",
cloneable = FALSE, cloneable = FALSE,
...@@ -31,7 +33,7 @@ Predictor <- R6Class( ...@@ -31,7 +33,7 @@ Predictor <- R6Class(
handle <- lgb.call("LGBM_BoosterCreateFromModelfile_R", ret = handle, lgb.c_str(modelfile)) handle <- lgb.call("LGBM_BoosterCreateFromModelfile_R", ret = handle, lgb.c_str(modelfile))
private$need_free_handle <- TRUE 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 # Check if model file is a booster handle already
handle <- modelfile handle <- modelfile
...@@ -131,7 +133,7 @@ Predictor <- R6Class( ...@@ -131,7 +133,7 @@ Predictor <- R6Class(
as.integer(num_iteration), as.integer(num_iteration),
private$params) private$params)
} else if (is(data, "dgCMatrix")) { } else if (methods::is(data, "dgCMatrix")) {
if (length(data@p) > 2147483647) { if (length(data@p) > 2147483647) {
stop("Cannot support large CSC matrix") stop("Cannot support large CSC matrix")
} }
......
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
#' } #' }
#' #'
#' @importFrom magrittr %>% #' @importFrom magrittr %>%
#' @importFrom data.table := #' @importFrom data.table := data.table
#' @importFrom jsonlite fromJSON
#' @export #' @export
lgb.model.dt.tree <- function(model, num_iteration = NULL) { lgb.model.dt.tree <- function(model, num_iteration = NULL) {
...@@ -77,6 +78,7 @@ 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) { single.tree.parse <- function(lgb_tree) {
# Traverse tree function # Traverse tree function
...@@ -161,6 +163,7 @@ single.tree.parse <- function(lgb_tree) { ...@@ -161,6 +163,7 @@ single.tree.parse <- function(lgb_tree) {
} }
#' @importFrom magrittr %>% extract inset
Lookup <- function(key, key_lookup, value_lookup, missing = NA) { Lookup <- function(key, key_lookup, value_lookup, missing = NA) {
# Match key by looked up key # Match key by looked up key
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment