Random Forest Classification Python

0
157

In this topic we would implement Random Forest classifier, using Python. We would try to understand practical application of Random Forest and codes used for classifier. As we have understood in our previous topic a random forest classifier is a group of decision tree classifier. We will also see as we increase the number of trees, the predictive power of the Random Forest classifier increases.

We would use Loan Default data to implement Random Forest Classification.

Step 1: Import the Libraries. We would use three libraries for this analysis:

  • numpy
  • pyplot
  • pandas

Use below command to import the libraries.

 

RND_FOR_1111

Step 2: Importing the data set

 

RND_FOR_1112

Step 3: Splitting the data set into the Training set and Test set

 

RND_FOR_1113

Step 4: Feature Scaling

 

RND_FOR_1114

Step 5: Fitting Random Forest Classification to the Training set

 

RND_FOR_1115

Step 6: Predicting the Test set results

RND_FOR_1116

Step 7: Making the Confusion Matrix

RND_FOR_1117

 

 

 

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here