Link Search Menu Expand Document

Import Library and Build Model

from sklearn.ensemble import RandomForestClassifier

RFClassifier = RandomForestClassifier(n_estimators=100).fit(x_train,y_train)
Here we give n_estimator = 100, which is number of Decision Tree=100.

We predict the values like below. RFPredictions = RFModel.predict(x_test)

We calculate confusion matrix and accuracy like below. Since these were explained well in previous pages, I am just posting the screenshot straight. Please see below.

The next post would be on Linear Regression. Stay Tuned!!!!