fix bug
This commit is contained in:
parent
0922883250
commit
3971323203
@ -25,6 +25,7 @@ importFrom(data.table,":=")
|
|||||||
importFrom(data.table,as.data.table)
|
importFrom(data.table,as.data.table)
|
||||||
importFrom(data.table,copy)
|
importFrom(data.table,copy)
|
||||||
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,set)
|
importFrom(data.table,set)
|
||||||
importFrom(data.table,setnames)
|
importFrom(data.table,setnames)
|
||||||
|
|||||||
@ -3,8 +3,10 @@
|
|||||||
#' Save a xgboost model to text file. Could be parsed later.
|
#' Save a xgboost model to text file. Could be parsed later.
|
||||||
#'
|
#'
|
||||||
#' @importFrom magrittr %>%
|
#' @importFrom magrittr %>%
|
||||||
#' @importFrom stringr str_split
|
|
||||||
#' @importFrom stringr str_replace
|
#' @importFrom stringr str_replace
|
||||||
|
#' @importFrom data.table fread
|
||||||
|
#' @importFrom data.table :=
|
||||||
|
#' @importFrom data.table setnames
|
||||||
#' @param model the model object.
|
#' @param model the model object.
|
||||||
#' @param fname the name of the text file where to save the model text dump. If not provided or set to \code{NULL} the function will return the model as a \code{character} vector.
|
#' @param fname the name of the text file where to save the model text dump. If not provided or set to \code{NULL} the function will return the model as a \code{character} vector.
|
||||||
#' @param fmap feature map file representing the type of feature.
|
#' @param fmap feature map file representing the type of feature.
|
||||||
@ -46,7 +48,9 @@ xgb.dump <- function(model = NULL, fname = NULL, fmap = "", with.stats=FALSE) {
|
|||||||
stop("fmap: argument must be type character (when provided)")
|
stop("fmap: argument must be type character (when provided)")
|
||||||
}
|
}
|
||||||
|
|
||||||
dt <- .Call("XGBoosterDumpModel_R", model, fmap, as.integer(with.stats), PACKAGE = "xgboost") %>% fread
|
longString <- .Call("XGBoosterDumpModel_R", model, fmap, as.integer(with.stats), PACKAGE = "xgboost")
|
||||||
|
|
||||||
|
dt <- fread(paste(longString, collapse = ""), sep = "\n", header = F)
|
||||||
|
|
||||||
setnames(dt, "Content")
|
setnames(dt, "Content")
|
||||||
|
|
||||||
|
|||||||
@ -91,7 +91,7 @@ Number of threads can also be manually specified via "nthread" parameter.
|
|||||||
\item \code{ndcg} Normalized Discounted Cumulative Gain. \url{http://en.wikipedia.org/wiki/NDCG}
|
\item \code{ndcg} Normalized Discounted Cumulative Gain. \url{http://en.wikipedia.org/wiki/NDCG}
|
||||||
}
|
}
|
||||||
|
|
||||||
More parameters are available in the Wiki \url{https://github.com/tqchen/xgboost/wiki/Parameters}
|
More parameters are available in the Wiki \url{https://github.com/tqchen/xgboost/wiki/Parameters}.
|
||||||
}
|
}
|
||||||
\examples{
|
\examples{
|
||||||
data(agaricus.train, package='xgboost')
|
data(agaricus.train, package='xgboost')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user