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

[R-package] added missing importFroms in NAMESPACE (#1627)

parent 5bb5f1b9
...@@ -38,9 +38,11 @@ export(slice) ...@@ -38,9 +38,11 @@ export(slice)
import(methods) import(methods)
importFrom(R6,R6Class) importFrom(R6,R6Class)
importFrom(data.table,":=") importFrom(data.table,":=")
importFrom(data.table,as.data.table)
importFrom(data.table,data.table) importFrom(data.table,data.table)
importFrom(data.table,rbindlist) importFrom(data.table,rbindlist)
importFrom(data.table,set) importFrom(data.table,set)
importFrom(data.table,setnames)
importFrom(graphics,barplot) importFrom(graphics,barplot)
importFrom(graphics,par) importFrom(graphics,par)
importFrom(jsonlite,fromJSON) importFrom(jsonlite,fromJSON)
...@@ -49,4 +51,5 @@ importFrom(magrittr,"%T>%") ...@@ -49,4 +51,5 @@ importFrom(magrittr,"%T>%")
importFrom(magrittr,extract) importFrom(magrittr,extract)
importFrom(magrittr,inset) importFrom(magrittr,inset)
importFrom(methods,is) importFrom(methods,is)
importFrom(stats,quantile)
useDynLib(lib_lightgbm , .registration = TRUE) useDynLib(lib_lightgbm , .registration = TRUE)
...@@ -373,6 +373,7 @@ generate.cv.folds <- function(nfold, nrows, stratified, label, group, params) { ...@@ -373,6 +373,7 @@ generate.cv.folds <- function(nfold, nrows, stratified, label, group, params) {
# Creates CV folds stratified by the values of y. # Creates CV folds stratified by the values of y.
# It was borrowed from caret::lgb.stratified.folds and simplified # It was borrowed from caret::lgb.stratified.folds and simplified
# by always returning an unnamed list of fold indices. # by always returning an unnamed list of fold indices.
#' @importFrom stats quantile
lgb.stratified.folds <- function(y, k = 10) { lgb.stratified.folds <- function(y, k = 10) {
## Group the numeric data based on their magnitudes ## Group the numeric data based on their magnitudes
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#' tree_imp1 <- lgb.importance(model, percentage = TRUE) #' tree_imp1 <- lgb.importance(model, percentage = TRUE)
#' tree_imp2 <- lgb.importance(model, percentage = FALSE) #' tree_imp2 <- lgb.importance(model, percentage = FALSE)
#' #'
#' @importFrom magrittr %>% %T>% #' @importFrom magrittr %>% %T>% extract
#' @importFrom data.table := #' @importFrom data.table :=
#' @export #' @export
lgb.importance <- function(model, percentage = TRUE) { lgb.importance <- function(model, percentage = TRUE) {
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#' #'
#' tree_interpretation <- lgb.interprete(model, test$data, 1:5) #' tree_interpretation <- lgb.interprete(model, test$data, 1:5)
#' #'
#' @importFrom data.table as.data.table
#' @importFrom magrittr %>% %T>% #' @importFrom magrittr %>% %T>%
#' @export #' @export
lgb.interprete <- function(model, lgb.interprete <- function(model,
...@@ -76,6 +77,7 @@ lgb.interprete <- function(model, ...@@ -76,6 +77,7 @@ lgb.interprete <- function(model,
} }
#' @importFrom data.table data.table
single.tree.interprete <- function(tree_dt, single.tree.interprete <- function(tree_dt,
tree_id, tree_id,
leaf_id) { leaf_id) {
...@@ -119,6 +121,8 @@ single.tree.interprete <- function(tree_dt, ...@@ -119,6 +121,8 @@ single.tree.interprete <- function(tree_dt,
} }
#' @importFrom data.table rbindlist
#' @importFrom magrittr %>% extract
multiple.tree.interprete <- function(tree_dt, multiple.tree.interprete <- function(tree_dt,
tree_index, tree_index,
leaf_index) { leaf_index) {
...@@ -134,6 +138,7 @@ multiple.tree.interprete <- function(tree_dt, ...@@ -134,6 +138,7 @@ multiple.tree.interprete <- function(tree_dt,
} }
#' @importFrom data.table set setnames
single.row.interprete <- function(tree_dt, num_class, tree_index_mat, leaf_index_mat) { single.row.interprete <- function(tree_dt, num_class, tree_index_mat, leaf_index_mat) {
# Prepare vector list # Prepare vector list
......
...@@ -34,7 +34,9 @@ ...@@ -34,7 +34,9 @@
#' #'
#' tree_interpretation <- lgb.interprete(model, test$data, 1:5) #' tree_interpretation <- lgb.interprete(model, test$data, 1:5)
#' lgb.plot.interpretation(tree_interpretation[[1]], top_n = 10) #' lgb.plot.interpretation(tree_interpretation[[1]], top_n = 10)
#' @importFrom data.table setnames
#' @importFrom graphics barplot par #' @importFrom graphics barplot par
#' @importFrom magrittr inset
#' @export #' @export
lgb.plot.interpretation <- function(tree_interpretation_dt, lgb.plot.interpretation <- function(tree_interpretation_dt,
top_n = 10, top_n = 10,
...@@ -85,6 +87,7 @@ lgb.plot.interpretation <- function(tree_interpretation_dt, ...@@ -85,6 +87,7 @@ lgb.plot.interpretation <- function(tree_interpretation_dt,
} }
} }
#' @importFrom graphics barplot
multiple.tree.plot.interpretation <- function(tree_interpretation, multiple.tree.plot.interpretation <- function(tree_interpretation,
top_n, top_n,
title, title,
......
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