xg_bo: Bayesian Optimization

Description Usage Arguments Value Examples

View source: R/xgez.R

Description

xg_bo use the bayesian optimization algorithm implemented in the rBayesianOptimization package in order to select the best set of parameters for an xgboost model.

Usage

1
2
3
4
5
6
xg_bo(data, eta = c(0.05, 0.3), gamma = c(0, 0.5), max_depth = c(1L,
  15L), colsample_bytree = c(0.5, 1), min_child_weight = c(1L, 7L),
  nrounds = 100, nthread = 2, cv = 5, seed = 1,
  objective = "auto", init_grid_dt = NULL, kernel = list(type =
  "exponential", power = 2), init_points = 10, n_iter = 50,
  acq = "ucb", kappa = 2.576, eps = 0, verbose = TRUE)

Arguments

data

Object. A data structure created by the call of the xg_load_data function.

eta

Numeric Vectors. Eta parameter min and max bounds.

gamma

Numeric Vector. Gamma parameter min and max bounds.

max_depth

Numeric Vector. Max_depth parameter min and max bounds. Use "L" suffix to indicate integer hyperparameter.

colsample_bytree

Numeric Vector. Colsample_bytree parameter min and max bounds.

min_child_weight

Numeric Vector. Min_child_weight parameter min and max bounds. Use "L" suffix to indicate integer hyperparameter.

nrounds

Numeric. Nrounds parameter for xgboost calibration. See xgb.train for more details.

nthread

Numeric. Nthread parameter for xgboost calibration. See xgb.train for more details.

cv

Numeric. Number of folds in cross validation. Needs to be more than 2.

seed

Numeric. Seed for computation reproducability.

objective

Character. Objective function for the optimization. . Eta parameter for xgboost calibration. See xgb.train for more details. Can be set to auto in order to let the function choose the better model regarding the output variable.

verbose

Logical. Verbose parameter for grid search.

...

Other parameters from BayesianOptimization.

Value

The optimization results with the following fields:

Examples

1
2
3
4
5
6
d <- xg_load_data(system.file("extdata", "titanic.csv", package = "ezXg"),
               inputs = c("Pclass", "Sex", "Age", "SibSp",
                          "Parch", "Fare", "Embarked"),
               output = "Survived",
               train.size = 0.8)
t <- xg_bo(d)

ArnaudBu/ezXg documentation built on Oct. 30, 2019, 4:59 a.m.