As we mentioned in the introduction to this recipe, the purpose of pipelines is to enable you to tweak your pipeline steps easily. In this section, we are going to tweak those steps to help us achieve a higher accuracy rate. In this case, we are simply going to extend the preceding code and add a classifier array of machine learning algorithms. From there, we will score the model so that we can determine which one was the best. The code for this is as follows:
from sklearn.metrics import accuracy_score, log_loss
from sklearn.neighbors import KNeighborsClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier, GradientBoostingClassifier
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis
classifiers = [
KNeighborsClassifier(3),
DecisionTreeClassifier(),
RandomForestClassifier(),
AdaBoostClassifier()...