Learn R Programming

butcher (version 0.3.5)

axe-xgb.Booster: Axing a xgb.Booster.

Description

xgb.Booster objects are created from the xgboost package, which provides efficient and scalable implementations of gradient boosted decision trees. Given the reliance of post processing functions on the model object, like xgb.Booster.complete, on the first class listed, the butcher_xgb.Booster class is not appended.

Usage

# S3 method for xgb.Booster
axe_call(x, verbose = FALSE, ...)

# S3 method for xgb.Booster axe_env(x, verbose = FALSE, ...)

Value

Axed xgb.Booster object.

Arguments

x

A model object.

verbose

Print information each time an axe method is executed. Notes how much memory is released and what functions are disabled. Default is FALSE.

...

Any additional arguments related to axing.

Examples

Run this code
if (FALSE) { # rlang::is_installed(c("parsnip", "xgboost"))
library(xgboost)
library(parsnip)

data(agaricus.train)
bst <- xgboost(data = agaricus.train$data,
               label = agaricus.train$label,
               eta = 1,
               nthread = 2,
               nrounds = 2,
               eval_metric = "logloss",
               objective = "binary:logistic",
               verbose = 0)

out <- butcher(bst, verbose = TRUE)

# Another xgboost model
fit <- boost_tree(mode = "classification", trees = 20) %>%
  set_engine("xgboost", eval_metric = "mlogloss") %>%
  fit(Species ~ ., data = iris)

out <- butcher(fit, verbose = TRUE)
}

Run the code above in your browser using DataLab