Skip to Content
Hands-On Unsupervised Learning with Python
book

Hands-On Unsupervised Learning with Python

by Giuseppe Bonaccorso
February 2019
Intermediate to advanced
386 pages
9h 54m
English
Packt Publishing
Content preview from Hands-On Unsupervised Learning with Python

PCA with the MNIST dataset

Now, let's apply the PCA, in order to reduce the dimensionality of the MNIST dataset. We are going to use the compressed version (1,797, 8 × 8 images) provided by scikit-learn, but none of our considerations will be affected by this choice. Let's start by loading and normalizing the dataset:

from sklearn.datasets import load_digitsdigits = load_digits()X = digits['data'] / np.max(digits['data'])

From the theoretical discussion, we know that the magnitude of the eigenvalues of the covariance matrix is proportional to the relative importance (that is, the explained variance, and therefore the informative content) of the corresponding principal component. Therefore, if they are sorted in descending order, it's possible ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Unsupervised Learning Using Python

Hands-On Unsupervised Learning Using Python

Ankur A. Patel
Introduction to Machine Learning with Python

Introduction to Machine Learning with Python

Andreas C. Müller, Sarah Guido

Publisher Resources

ISBN: 9781789348279Supplemental Content