How to reduce the size of GBM trained model

How to reduce the size of the trained gbm model using Caret package in R Language. I have trained my model on 9 variables and 44500 observations and model size is almost 6.7GB. How can we reduce the size of this model?

assuming your model has some name like gbmFit1 find out what parts of the object take up space

imap_dfr(gbmFit1,~tibble(size=obj_size(.x),name=.y)) %>% arrange(desc(size)) %>% print(n=Inf)

if its for example trainingData, and you want to throw it out ..

gbmFit2 <- gbmFit1
gbmFit2$trainingData <- NULL
# test if still work as a model post our excision
predict(gbmFit2,newdata = testing)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.