Description Usage Arguments Value Examples
xg_train
trains an xgboost model in order on the data structure
generated by the xg_load_data function.
1 2 3 |
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. |
A trained model with following values:
model: calibrated model as returned by the xgb.train function.
ntree: optimal number of tree according to the test set.
formula: the formula used for constructing the model matrix and that is applied when running the model.
template: an empty data.table
that has saved all the
input values and that is used to appropriately format data when using
the prediction function.
labels: The possible labels for prediction when performing a classification task with xgboost.
na.handle: passed to reapply to prediction
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.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.