Solved – Boosting: In the function gbm() from library gbm and understanding the cv.folds implementation

boostingr

In the function gbm() there is a parameter cv.folds. I know this is performing cross-validation but what I don't understand is how to interpret it. I tried extracting it using $cv.error but was greeted with a list of values that seemed to only range from 0.75 to ~0.98.

So what exactly is this parameter doing? If I run this function to boost a classifier, is cv.folds returning cross validation error on each classifier?

Best Answer

This question can be answered by consulting the documentation:

if cv.folds < 2 this component is NULL. Otherwise, this component is a vector of length equal to the number of fitted trees containing a cross-validated estimate of the loss function for each boosting iteration.

So each of the numbers in your vector is an estimate the loss of a fitted version of your model using one cross validation fold. To interpret the numbers we would need to know what loss function you were using for your gbm.