I have unbalanced dataset (6% positive), I have used and xgboost model from caret package.
this is my code:
gbmGrid <- expand.grid(nrounds = 50,
eta = 0.4,
max_depth = 2,
gamma = 0,
colsample_bytree=0.8,
min_child_weight=1,
subsample=1)
ctrl <- trainControl(method = "cv",
number = 10,
search = "grid",
fixedWindow = TRUE,
verboseIter = TRUE,
returnData = TRUE,
returnResamp = "final",
savePredictions = "all",
classProbs = TRUE,
summaryFunction = twoClassSummary,
sampling = "smote",
selectionFunction = "best",
trim = FALSE,
allowParallel = TRUE)
classifier <- train(x = training_set[,-1],y = training_set[,1], method = 'xgbTree',metric = "ROC",trControl = ctrl,tuneGrid = gbmGrid)
the problem is that every time I "run" the train line it gives different roc, sensetivity and specificity.
ROC Sens Spec
0.696084 0.8947368 0.2736111
ROC Sens Spec
0.6655806 0.8917293 0.2444444
** the expand.grid is set on the best tune model.
does someone understand why the model isn't stable?