Almost all of the machine learning packages / functions in R allow you to obtain cross-validation performance metrics while training a model.
From what I can tell, the only way to do cross-validation with xgboost is to setup a xgb.cv
statement like this:
clf <- xgb.cv( params = param,
data = dtrain,
nrounds = 1000,
verbose = 1,
watchlist = watchlist,
maximize = FALSE,
nfold = 2,
nthread = 2,
prediction = T
)
but even with that option of prediction = T
you're merely getting the prediction results from your training data. I don't see a way to use the resulting object (clf
in this example) in a predict
statement with new data.
Is my understanding accurate and is there any work-around?