January 2018
Beginner to intermediate
316 pages
7h 14m
English
Finally, we arrive at the moment where we can try using both PCA and LDA in our machine learning pipelines. Because we have been working with the iris dataset extensively in this chapter, we will continue to demonstrate the utility of both LDA and PCA as feature transformational pre-processing steps for supervised and unsupervised machine learning.
We will start with supervised machine learning and attempt to build a classifier to recognize the species of flower given the four quantitative flower traits:
from sklearn.neighbors import KNeighborsClassifierfrom sklearn.pipeline import Pipelinefrom sklearn.model_selection import cross_val_score
We will use ...
Read now
Unlock full access