xg_gs: Grid search

Description Usage Arguments Value Examples

View source: R/xgez.R

Description

xg_gs use coordinate descent (https://en.wikipedia.org/wiki/Coordinate_descent) in order to select the best set of parameters for an xgboost model. At the end of the coordinate descent algorithm, a full search on each of the individual parameter vectors is made in order to potentially improve the selection.

Usage

1
2
3
4
5
xg_gs(data, eta = c(0.05, 0.1, 0.15, 0.2, 0.25, 0.3), gamma = c(0, 0.1,
  0.2, 0.3, 0.4, 0.5), max_depth = c(1, 3, 4, 5, 6, 8, 10, 12, 15),
  colsample_bytree = c(0.3, 0.4, 0.5, 0.7, 0.8, 0.9, 1),
  min_child_weight = c(1, 3, 5, 7), nrounds = 100, nthread = 2,
  cv = 5, seed = 1, verbose = TRUE, objective = "auto")

Arguments

data

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

eta

Numeric Vectors. Eta parameter list for grid search. See xgb.train for more details.

gamma

Numeric Vector. Gamma parameter list for grid search. See xgb.train for more details.

max_depth

Numeric Vector. Max_depth parameter list for grid search. See xgb.train for more details.

colsample_bytree

Numeric Vector. Colsample_bytree parameter list for grid search. See xgb.train for more details.

min_child_weight

Numeric Vector. Min_child_weight parameter list for grid search. See xgb.train for more details.

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.

verbose

Logical. Verbose parameter for grid search.

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.

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_gs(d)

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