@Rohit_Nair wrote:
Here I m trying to do parameter tuning in xgboost using caret pacakge.I m getting a warning msg like this. Pls tell me what should i do so that i can remove this warning and i can get the accuracy of the model for the paramters selected.
ERROR :
In train.default(x = data.matrix(train), y = a, trControl = xgb_trcontrol_1, :
The metric "Accuracy" was not in the result set. ROC will be used instead.Code :
Dataset : BNP paribas Kaggle Comp
library(caret)
train <- read.csv("train.csv")
test <- read.csv("test.csv")train[is.na(train)] <- -1
test[is.na(test)] <- -1train$target <- as.factor(train$target)
set up the cross-validated hyper-parameter search
xgb_grid_1 = expand.grid(
nrounds = 140,
eta = 0.2,
max_depth = c(6,8,10),
gamma = 0,
colsample_bytree = 0.8,
# subsample = 0.8,
min_child_weight = c(1,6,2))
# scale_pos_weight = 1)pack the training control parameters
xgb_trcontrol_1 = trainControl(
method = "cv",
number = 5,
verboseIter = TRUE,
returnData = FALSE,
returnResamp = "all", # save losses across all models
classProbs = TRUE, # set to TRUE for AUC to be computed
summaryFunction = twoClassSummary,
allowParallel = TRUE
)a<- make.names(train$target,unique=F)
train the model for each parameter combination in the grid,
using CV to evaluate
xgb_train_1 = train(
x = data.matrix(train),
y = a,
trControl = xgb_trcontrol_1,
tuneGrid = xgb_grid_1,
method = "xgbTree"
)Result :
xgb_train_1
Aggregating results
Selecting tuning parameters
Fitting nrounds = 140, max_depth = 6, eta = 0.2, gamma = 0, colsample_bytree = 0.8, min_child_weight = 1 on full training setResampling results across tuning parameters:
max_depth min_child_weight ROC Sens Spec ROC SD Sens SD Spec SD
6 1 1 1 1 0 0 0
6 2 1 1 1 0 0 0
6 6 1 1 1 0 0 0
8 1 1 1 1 0 0 0
8 2 1 1 1 0 0 0
8 6 1 1 1 0 0 0
10 1 1 1 1 0 0 0
10 2 1 1 1 0 0 0
10 6 1 1 1 0 0 0Everything is Zero
![]()
I dont know were i m getting wrong. Pls help me out with the code@aayushmnit @Lesaffrea @shuvayan @Aarshay @Manish
Thanks,
Rohit
Posts: 1
Participants: 1