In this topic we would implement Random Forest Regression, using R. We would try to understand practical application of Random Forest and codes used for regression. As we have understood in our previous topic a random forest regression is a group of decision tree.
Let us look into codes step by step.
Step 1: First setup the working library for the R-Studio or whichever interface you are using. We set a working library as it becomes easier to importing the stored dataset or even while saving final codes.
Step 2: Import the Data set:
Data set contains Position, Level and Salary.
Step 3: We would use “randomForest” package while working with Random Forest. First try to install the package using the following code.
Step 4: In this analysis we would use just last two columns. So we would select last two columns using the following command
Step 5: Following code will help us build random forest model
Step 6: Predicting the Test Results