* [R] add native routines registration * c_api.h needs to include <cstdint> since it uses fixed width integer types * [R] use registered native routines from R code * [R] bump version; add info on native routine registration to the contributors guide * make lint happy
24 lines
715 B
R
24 lines
715 B
R
#' Save xgboost model to R's raw vector,
|
|
#' user can call xgb.load to load the model back from raw vector
|
|
#'
|
|
#' Save xgboost model from xgboost or xgb.train
|
|
#'
|
|
#' @param model the model object.
|
|
#'
|
|
#' @examples
|
|
#' data(agaricus.train, package='xgboost')
|
|
#' data(agaricus.test, package='xgboost')
|
|
#' train <- agaricus.train
|
|
#' test <- agaricus.test
|
|
#' bst <- xgboost(data = train$data, label = train$label, max_depth = 2,
|
|
#' eta = 1, nthread = 2, nrounds = 2,objective = "binary:logistic")
|
|
#' raw <- xgb.save.raw(bst)
|
|
#' bst <- xgb.load(raw)
|
|
#' pred <- predict(bst, test$data)
|
|
#'
|
|
#' @export
|
|
xgb.save.raw <- function(model) {
|
|
model <- xgb.get.handle(model)
|
|
.Call(XGBoosterModelToRaw_R, model)
|
|
}
|