Classifying data with random forest
Random forest is another useful ensemble learning method that grows multiple decision trees during the training process. Each decision tree will output its own prediction results corresponding to the input. The forest will use the voting mechanism to select the most voted class as the prediction result. In this recipe, we will illustrate how to classify data using the randomForest
package.
Getting ready
In this recipe, we will continue to use the telecom churn
dataset as the input data source to perform classifications with the random forest method.
How to do it...
Perform the following steps to classify data with random forest:
- First, you have to install and load the
randomForest
package;> install.packages("randomForest") ...
Get R: Recipes for Analysis, Visualization and Machine Learning 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.