0

I am using caret's train function in R to produce a model using GBM. I have used repeated cross-validation with 5 repititions meaning there will be 50 samples. I want to ask if there is a way to plot the results in a different way such that the plot shows the boosting iterations on the x-axis and auc on the y-axis and inside it shows the results obtained from the best parameter selection but a separate line for training folds and test folds. This can be produced when you use "gbm" function from the gbm package and use "gbm.perf" along with sampling technique to plot the training and validation curve for deviance.

Is it possible to do the same with caret's train function somehow?

Thanks.

Lars Kotthoff
  • 107,425
  • 16
  • 204
  • 204
syebill
  • 543
  • 6
  • 23

1 Answers1

1

Within your caret object, if you used method='gbm', you can select the attribute 'finalModel', which is the resulting gbm object. For example, if your train object is named 'a', then

gbm_model <- a$finalModel

With gbm_model, you can then run the functions internal to the gbm package.

DP5000
  • 36
  • 6
  • Hi. Thanks for the useful answer. Can I ask is it possible to draw several training curves within one plot using gbm.perf function from gbm package. As I have a number of models and plotting them separately does not provide a meaningful visual presentation. – syebill Oct 03 '15 at 23:07
  • Yes, you can. You just have to use 'cv.error' and 'train.error' as your y's - which you can also get from the gbm object - and plot using R's default plot method. – DP5000 Oct 05 '15 at 15:08