Applied facial recognition

Now, we can move on to the machine learning pipelines that will be used to create our facial recognition models:

  1. We can start by creating train, test, and split in our dataset, as shown in the following code block:
# let's split our dataset into training and testing
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=1)
  1. We are ready to perform a Principal Component Analysis (PCA) on our dataset. We will want to instantiate a PCA first and ensure that we scale our data before applying PCA in our pipeline. This can be done as follows:
# instantiate the PCA module
pca = PCA(n_components=200, whiten=True)

# create a pipeline called preprocessing that will scale data and ...

Get Feature Engineering Made Easy now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.