Skip to Main Content
Hands-On Unsupervised Learning with Python
book

Hands-On Unsupervised Learning with Python

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

Example of a deep convolutional GAN

We can now implement a DCGAN, based on the model proposed in Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks, Radford A., Metz L., and Chintala S., arXiv:1511.06434 [cs.LG], and the Olivetti faces dataset, which is small enough to allow for a quick training phase.

Let's start by loading the dataset and normalizing the values in the range (-1, 1), as follows:

from sklearn.datasets import fetch_olivetti_facesfaces = fetch_olivetti_faces(shuffle=True, random_state=1000)X_train = faces['images']X_train = (2.0 * X_train) - 1.0width = X_train.shape[1]height = X_train.shape[2]

A few sample faces are shown in the following screenshot:

Sample faces drawn from the Olivetti ...
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