xgb.auc: xgb.auc

Description Usage Arguments Value Examples

View source: R/xgb_auc.R

Description

xgb.auc is an automatic parameter adjustment function which is applied to the Classification task by xgboost.

Usage

1
2
3
4
5
6
7
8
9
xgb.auc(
  data,
  n,
  cvround = cvround,
  cvfold = cvfold,
  early_stopping_rounds = early_stopping_rounds,
  seed.number = seed.number,
  nthread = nthread
)

Arguments

data

training dataset. xgb.auc accepts only an xgb.DMatrix as the input.

n

the number of cycles.

cvround

max number of boosting iterations.

cvfold

the original dataset is randomly partitioned into nfold equal size subsamples.

early_stopping_rounds

If NULL, the early stopping function is not triggered. If set to an integer k, training with a validation set will stop if the performance doesn't improve for k rounds.

seed.number

random number seed.

nthread

number of thread used in training.

Value

a list contains the best_param,the best_auc and best_auc_index.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(xgboost)
data(redwine,package="XGBparsel")
redwine$grade[redwine$quality <= 5] <- "0"
redwine$grade[redwine$quality >= 6] <- "1"
myvars <- names(redwine) %in% "quality"
redwine <- redwine[!myvars]
redwine_s <- Matrix::sparse.model.matrix( grade~.-1 ,data = redwine)
train <- xgb.DMatrix( data = redwine_s , label = redwine$grade )
fit <-xgb.auc(train,10,cvround=100,cvfold=5,
                  early_stopping_rounds =10,
                  seed.number = 12345,nthread = 8)

zhangyuqiangarchie/XGBparsel2 documentation built on Dec. 23, 2021, 9:18 p.m.