Random Forest Regression-R

0
276

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.

RF_R1

Step 2: Import the Data set:

RF_R2

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.

RF_R3

Step 4: In this analysis we would use just last two columns. So we would select last two columns using the following command

RF_R4

Step 5: Following code will help us build random forest model

RF_R5

Step 6: Predicting the Test Results

RF_R6

LEAVE A REPLY

Please enter your comment!
Please enter your name here