Lab 5 Instructions (6%) Face Clustering Task: Apply PCA and
K-Means on Face Dataset. The classic Olivetti faces dataset
contains 400 grayscale 64 × 64–pixel images of faces. In this lab
task, we will cluster these face images using K-Means and visualize
the result to observe similarities in each cluster. Olivetti
dataset:
https://scikit-learn.org/stable/modules ... faces.html
Step 1: Load Olivetti face dataset. [1’] Load the dataset using
the sklearn.datasets.fetch_olivetti_faces() function. Explain why
each row of ‘data’ is a 1D vector of size 4096, and how many
different labels this dataset has.
Step 2: Train Test Split. Split the dataset into training and
test sets with train_test_split(). Set parameter test_size = 0.3,
random_state to the last two digits of your student ID. Please
attach your name and student id in a separate markdown cell as
proof.
Step3: Reduce Dimensionality with PCA. [2’] To speed things up,
reduce the training data's dimensionality using PCA. Please set the
ratio of variance you wish to preserve as 99%. Then, please answer
the below questions: 1) What’s the dimensionality of the original
training data? 2) What’s the dimensionality of the compressed
training data?
Step 4: Cluster the compressed training images using K-Means.
[2’] Please set the number of clusters as 120 and the random_state
as the last two digits of your student id. Step 5: Visualize the
clusters. [1’] Visualize the clusters. You can use the provided
function ‘plot_faces’ (see Lab5_hints.ipynb). What do you think of
the clustering result? Do you see similar faces in each cluster?
P.s. Expected clustering outputs may like:
*Please use google colab
cluster 0 32 32 32 32 Cluster 1 13 13 13 13 Cluster 2 14 14 14
Lab 5 Instructions (6%) Face Clustering Task: Apply PCA and K-Means on Face Dataset. The classic Olivetti faces dataset
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Lab 5 Instructions (6%) Face Clustering Task: Apply PCA and K-Means on Face Dataset. The classic Olivetti faces dataset
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!