Let's now try the first ensemble classifier. The forest in Random forest classifiers comes from the fact that each instance of this classifier consists of several decision trees. The Random in Random forests comes from the fact that each tree selects a finite number of features from all features at random, as shown in the following code:
from sklearn.ensemble import RandomForestClassifier as RFCrfc_clf = Pipeline([('vect', CountVectorizer()), ('tfidf', TfidfTransformer()), ('clf',RFC())])rfc_clf.fit(X=X_train, y=y_train)rfc_acc, rfc_predictions = imdb_acc(rfc_clf)rfc_acc # 0.7226
Although considered to be very powerful when used in most machine learning tasks, the Random Forest approach doesn't do particularly well ...