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 ...

Get Mastering Machine Learning with R - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.