gbt: Gradient Boosted Trees using XGBoost

View source: R/gbt.R

gbtR Documentation

Gradient Boosted Trees using XGBoost

Description

Gradient Boosted Trees using XGBoost

Usage

gbt(
  dataset,
  rvar,
  evar,
  type = "classification",
  lev = "",
  max_depth = 6,
  learning_rate = 0.3,
  min_split_loss = 0,
  min_child_weight = 1,
  subsample = 1,
  nrounds = 100,
  early_stopping_rounds = 10,
  nthread = 12,
  wts = "None",
  seed = NA,
  data_filter = "",
  arr = "",
  rows = NULL,
  envir = parent.frame(),
  ...
)

Arguments

dataset

Dataset

rvar

The response variable in the model

evar

Explanatory variables in the model

type

Model type (i.e., "classification" or "regression")

lev

Level to use as the first column in prediction output

max_depth

Maximum 'depth' of tree

learning_rate

Learning rate (eta)

min_split_loss

Minimal improvement (gamma)

min_child_weight

Minimum number of instances allowed in each node

subsample

Subsample ratio of the training instances (0-1)

nrounds

Number of trees to create

early_stopping_rounds

Early stopping rule

nthread

Number of parallel threads to use. Defaults to 12 if available

wts

Weights to use in estimation

seed

Random seed to use as the starting point

data_filter

Expression entered in, e.g., Data > View to filter the dataset in Radiant. The expression should be a string (e.g., "price > 10000")

arr

Expression to arrange (sort) the data on (e.g., "color, desc(price)")

rows

Rows to select from the specified dataset

envir

Environment to extract data from

...

Further arguments to pass to xgboost

Details

See https://radiant-rstats.github.io/docs/model/gbt.html for an example in Radiant

Value

A list with all variables defined in gbt as an object of class gbt

See Also

summary.gbt to summarize results

plot.gbt to plot results

predict.gbt for prediction

Examples

## Not run: 
gbt(titanic, "survived", c("pclass", "sex"), lev = "Yes") %>% summary()
gbt(titanic, "survived", c("pclass", "sex")) %>% str()

## End(Not run)
gbt(
  titanic, "survived", c("pclass", "sex"), lev = "Yes",
  early_stopping_rounds = 0, nthread = 1
) %>% summary()
gbt(
  titanic, "survived", c("pclass", "sex"),
  early_stopping_rounds = 0, nthread = 1
) %>% str()
gbt(
  titanic, "survived", c("pclass", "sex"),
  eval_metric = paste0("error@", 0.5 / 6), nthread = 1
) %>% str()
gbt(
  diamonds, "price", c("carat", "clarity"), type = "regression", nthread = 1
) %>% summary()


radiant.model documentation built on Oct. 16, 2023, 9:06 a.m.