Skip to Content
Analytics for the Internet of Things (IoT)
book

Analytics for the Internet of Things (IoT)

by Andrew Minteer
July 2017
Beginner to intermediate
378 pages
10h 26m
English
Packt Publishing
Content preview from Analytics for the Internet of Things (IoT)

The Gradient Boosting Machines R example

In R, the gbm package can be used to train a GBM. GBMs have the tuning parameters of tree depth and shrinkage. As always, the beauty and danger of R is that it can tune these parameters for you. The following code uses the caret package to fit a GBM model and optimize the tuning parameters:

#make sure needed packages are installed, then load themif(!require(gbm)){ install.packages("gbm")}library(gbm)#reuse train control and training data from random forest example#train the random forest model and specify the number of trees. Use caret to control cross-validation gbmModel <- train (trainData[,predictors], trainData[,target], method = "gbm", trControl = ctrlCV, verbose = FALSE)#run prediction on test ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Big Data Analytics for Internet of Things

Big Data Analytics for Internet of Things

Tausifa Jan Saleem, Mohammad Ahsan Chishti
Hands-On Industrial Internet of Things

Hands-On Industrial Internet of Things

Giacomo Veneri, Antonio Capasso
Internet of Things

Internet of Things

Mayur Ramgir

Publisher Resources

ISBN: 9781787120730Supplemental Content