xg_train: Calibrate Model

Description Usage Arguments Value Examples

View source: R/xgez.R

Description

xg_train trains an xgboost model in order on the data structure generated by the xg_load_data function.

Usage

1
2
3
xg_train(data, eta = 0.3, gamma = 0, max_depth = 6,
  colsample_bytree = 1, min_child_weight = 1, nrounds = 100,
  nthread = 2, verbose = 1, cv = 1, seed = 1, objective = "auto")

Arguments

data

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

eta

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

gamma

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

max_depth

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

colsample_bytree

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

min_child_weight

Numeric. Min_child_weight parameter for xgboost calibration. 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.

verbose

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

cv

Numeric. Number of folds in cross validation. If this parameter is set to 1, this means that cross-validation will not be performed.

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.

Value

A trained model with following values:

In case the parameter cv is set to anithing but 1, the function returns a 1 line data.table with the average error on the cross-validation.

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)
md <- xg_train(d)

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