How to do it...

We start by importing the remaining libraries we need:

  1. Import the required libraries:
import osimport numpy as npimport pandas as pdimport itertoolsimport warningsimport stringimport matplotlib.pyplot as pltfrom nltk.corpus import stopwordsfrom nltk.stem import WordNetLemmatizerfrom sklearn.feature_extraction.text import CountVectorizerfrom sklearn.feature_extraction.text import TfidfVectorizerfrom sklearn.model_selection import train_test_splitfrom sklearn.naive_bayes import MultinomialNBfrom sklearn.metrics import confusion_matrixfrom sklearn.model_selection import GridSearchCVfrom sklearn.ensemble import RandomForestClassifierfrom sklearn.metrics import classification_reportfrom sklearn.metrics import roc_auc_score as ...

Get Ensemble Machine Learning Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.