O'Reilly logo

Mastering Machine Learning with R - Second Edition by Cory Lesmeister

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Random forest classification

Perhaps you are disappointed with the performance of the random forest regression model, but the true power of the technique is in the classification problems. Let's get started with the breast cancer diagnosis data. The procedure is nearly the same as we did with the regression problem:

  > set.seed(123)   > rf.biop <- randomForest(class ~. , data = biop.train)  > rf.biop  Call:   randomForest(formula = class ~ ., data = biop.train)          Type of random forest: classification             Number of trees: 500  No. of variables tried at each split: 3      OOB estimate of error rate: 3.16%  Confusion matrix:       benign malignant class.error  benign    294     8 0.02649007  malignant   7    165 0.04069767

The OOB error rate is 3.16%. Again, this is with all ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required