Home Random Forest Classification
Post
Cancel

Random Forest Classification

What is Random Forest Classification?

Its basic algorithm is the same as Random Forest Regression except that predicting a value sets a category.


Example



Code



1
2
3
4
5
6
7
8
9
10
11
from sklearn.ensemble import RandomForestClassifier
from sklearn.preprocessing import StandardScaler

sc = StandardScaler()
X_train = sc.fit_transform(X_train)
X_test = sc.transform(X_test)

classifier = RandomForestClassifier(n_estimators = 100, criterion = 'entropy', random_state = 0)
classifier.fit(X_train, y_train)

y_pred = classifier.predict(X_test)



Result







Implementation

This post is licensed under CC BY 4.0 by the author.