text_plain_output_1.png
from sklearn.ensemble import RandomForestClassifier

from sklearn.metrics import accuracy_score

rf_clf = RandomForestClassifier(n_estimators=1000)
rf_clf.fit(X_train, y_train)

y_pred_rf = rf_clf.predict(X_test)
rf_err_rate = 1 - accuracy_score(y_test, y_pred_rf)
print('Random forest classifier error: ' + str(rf_err_rate))