[R] consolidate importFrom-s; parameter style

This commit is contained in:
Vadim Khotilovich 2016-06-27 01:50:03 -05:00
parent b9aeeda074
commit 8473b18c3d
2 changed files with 22 additions and 13 deletions

View File

@ -12,11 +12,12 @@ S3method(slice,xgb.DMatrix)
export("xgb.attr<-") export("xgb.attr<-")
export("xgb.attributes<-") export("xgb.attributes<-")
export("xgb.parameters<-") export("xgb.parameters<-")
export(cb.early_stop) export(cb.cv.predict)
export(cb.log_evaluation) export(cb.early.stop)
export(cb.print_evaluation) export(cb.evaluation.log)
export(cb.reset_parameters) export(cb.print.evaluation)
export(cb.save_model) export(cb.reset.parameters)
export(cb.save.model)
export(getinfo) export(getinfo)
export(print.xgb.Booster) export(print.xgb.Booster)
export(print.xgb.DMatrix) export(print.xgb.DMatrix)
@ -51,7 +52,6 @@ importFrom(Matrix,sparseVector)
importFrom(data.table,":=") importFrom(data.table,":=")
importFrom(data.table,as.data.table) importFrom(data.table,as.data.table)
importFrom(data.table,data.table) importFrom(data.table,data.table)
importFrom(data.table,fread)
importFrom(data.table,rbindlist) importFrom(data.table,rbindlist)
importFrom(data.table,setnames) importFrom(data.table,setnames)
importFrom(magrittr,"%>%") importFrom(magrittr,"%>%")
@ -59,5 +59,6 @@ importFrom(stringr,str_detect)
importFrom(stringr,str_extract) importFrom(stringr,str_extract)
importFrom(stringr,str_match) importFrom(stringr,str_match)
importFrom(stringr,str_replace) importFrom(stringr,str_replace)
importFrom(stringr,str_replace_all)
importFrom(stringr,str_split) importFrom(stringr,str_split)
useDynLib(xgboost) useDynLib(xgboost)

View File

@ -5,8 +5,8 @@
#' @export #' @export
xgboost <- function(data = NULL, label = NULL, missing = NA, weight = NULL, xgboost <- function(data = NULL, label = NULL, missing = NA, weight = NULL,
params = list(), nrounds, params = list(), nrounds,
verbose = 1, print.every.n = 1L, verbose = 1, print_every_n = 1L,
early.stop.round = NULL, maximize = NULL, early_stopping_rounds = NULL, maximize = NULL,
save_period = 0, save_name = "xgboost.model", save_period = 0, save_name = "xgboost.model",
xgb_model = NULL, callbacks = list(), ...) { xgb_model = NULL, callbacks = list(), ...) {
@ -16,8 +16,8 @@ xgboost <- function(data = NULL, label = NULL, missing = NA, weight = NULL,
if (verbose > 0) if (verbose > 0)
watchlist$train = dtrain watchlist$train = dtrain
bst <- xgb.train(params, dtrain, nrounds, watchlist, verbose = verbose, print.every.n=print.every.n, bst <- xgb.train(params, dtrain, nrounds, watchlist, verbose = verbose, print_every_n=print_every_n,
early.stop.round = early.stop.round, maximize = maximize, early_stopping_rounds = early_stopping_rounds, maximize = maximize,
save_period = save_period, save_name = save_name, save_period = save_period, save_name = save_name,
xgb_model = xgb_model, callbacks = callbacks, ...) xgb_model = xgb_model, callbacks = callbacks, ...)
return(bst) return(bst)
@ -79,15 +79,23 @@ NULL
# Various imports # Various imports
#' @importClassesFrom Matrix dgCMatrix dgeMatrix #' @importClassesFrom Matrix dgCMatrix dgeMatrix
#' @importFrom Matrix cBind
#' @importFrom Matrix colSums
#' @importFrom Matrix sparse.model.matrix
#' @importFrom Matrix sparseVector
#' @importFrom data.table data.table #' @importFrom data.table data.table
#' @importFrom data.table as.data.table #' @importFrom data.table as.data.table
#' @importFrom magrittr %>%
#' @importFrom data.table := #' @importFrom data.table :=
#' @importFrom data.table rbindlist #' @importFrom data.table rbindlist
#' @importFrom data.table setnames
#' @importFrom magrittr %>%
#' @importFrom stringr str_detect
#' @importFrom stringr str_extract #' @importFrom stringr str_extract
#' @importFrom stringr str_split
#' @importFrom stringr str_replace
#' @importFrom stringr str_match #' @importFrom stringr str_match
#' @importFrom stringr str_replace
#' @importFrom stringr str_replace_all
#' @importFrom stringr str_split
#'
#' @import methods #' @import methods
#' @useDynLib xgboost #' @useDynLib xgboost
NULL NULL